Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] [patch] av7110_attach()



On Mon, 1 Mar 2004, Manfred Petz wrote:

| On Fri, 27 Feb 2004, Johannes Stezenbach wrote:
|
| | >
| | > With excessively I mean an endless loop, running for about an hour,
| | > permanently unloading/loading.
| |
| | Then just don't do that. Problem solved :-)
| |

Well, I don't know, if that solves my problem (still testing), but there is
a bug in av7110_attach(): the struct av7110 gets kfree()'d in case of
some initializiation errors, but arm_thread() is still running.

It occurs, if av7110_init_v4l() fails (I dunno why, but this seems to
be the case here sometimes). Another issue: the struct av7110 gets kfree()'d
in this case, but members of it are accessed a few lines below.

Maybe the fix it's not the best solution, but please take a look on it. :)

pm




diff -uNr dvb-orig/linux/drivers/media/dvb/ttpci/av7110.c linuxtv-dvb-1.1.0/linux/drivers/media/dvb/ttpci/av7110.c
--- dvb-orig/linux/drivers/media/dvb/ttpci/av7110.c	2004-01-31 12:31:35.000000000 +0100
+++ linuxtv-dvb-1.1.0/linux/drivers/media/dvb/ttpci/av7110.c	2004-03-01 13:32:48.000000000 +0100
@@ -116,7 +116,7 @@
 	dvb_kernel_thread_setup("arm_mon");
 	av7110->arm_thread = current;

-	while (1) {
+	while (arm_thread_keep) {
 		timeout = wait_event_interruptible_timeout(av7110->arm_wait,0 != av7110->arm_rmmod, 5*HZ);
 		if (-ERESTARTSYS == timeout || 0 != av7110->arm_rmmod) {
 			/* got signal or told to quit*/
@@ -1351,6 +1351,7 @@
 	DEB_EE(("av7110: %p\n", av7110));
 	memset(av7110, 0, sizeof(struct av7110));

+	av7110->arm_thread_keep = 1;
 	av7110->card_name = (char*) pci_ext->ext_priv;
 	av7110->dev = (struct saa7146_dev *) dev;
 	dev->ext_priv = av7110;
@@ -1505,9 +1506,6 @@
 	return 0;

 err:
-	if (NULL != av7110 ) {
-		kfree(av7110);
-	}
 	if (NULL != av7110->debi_virt) {
 		pci_free_consistent(dev->pci, 8192, av7110->debi_virt, av7110->debi_bus);
 	}
@@ -1520,6 +1518,13 @@

 	dvb_unregister_adapter (av7110->dvb_adapter);

+	if (NULL != av7110 ) {
+		av7110->arm_thread_keep=0;
+		while (av7110->arm_thread)
+			usleep (1);
+		kfree(av7110);
+	}
+
 	return ret;
 }

diff -uNr dvb-orig/linux/drivers/media/dvb/ttpci/av7110.h linuxtv-dvb-1.1.0/linux/drivers/media/dvb/ttpci/av7110.h
--- dvb-orig/linux/drivers/media/dvb/ttpci/av7110.h	2004-01-05 17:58:20.000000000 +0100
+++ linuxtv-dvb-1.1.0/linux/drivers/media/dvb/ttpci/av7110.h	2004-03-01 13:30:52.000000000 +0100
@@ -168,6 +168,7 @@

 	/* AV711X */

+	int                 arm_thread_keep;
 	u32		    arm_fw;
 	u32		    arm_rtsl;
 	u32		    arm_vid;
pm


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index