summary refs log tree commit diff
path: root/drivers
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2008-02-06 04:24:51 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 14:09:46 -0300
commitceb4340deb9bf5f8371d47ef906a83e6784345b0 (patch)
tree10e9e3e24d59c86783fde652beb24ffdb9211e31 /drivers
parente2780fb41102f9844ae6182c03908f03c3cb9163 (diff)
downloadlinux-ceb4340deb9bf5f8371d47ef906a83e6784345b0.tar.gz
V4L/DVB (7687): pvrusb2: Fix oops in pvrusb2-dvb
The pvrusb2-dvb feed thread cannot be allowed to exit by itself
without first waiting for kthread_should_stop() to return true.
Otherwise the driver will have a dangling task_struct context, which
will cause a very nasty kernel oops.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-dvb.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.c b/drivers/media/video/pvrusb2/pvrusb2-dvb.c
index 69ac59aa654c..dd693a1980e8 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-dvb.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.c
@@ -138,9 +138,8 @@ static void pvr2_dvb_fh_done(struct pvr2_dvb_fh *fh)
 	pvr2_channel_done(&fh->channel);
 }
 
-static int pvr2_dvb_feed_thread(void *data)
+static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap)
 {
-	struct pvr2_dvb_adapter *adap = data;
 	struct pvr2_dvb_fh fh;
 	int ret;
 	unsigned int count;
@@ -203,12 +202,18 @@ static int pvr2_dvb_feed_thread(void *data)
 
 	printk(KERN_DEBUG "dvb thread stopped\n");
 
+	return 0;
+}
+
+static int pvr2_dvb_feed_thread(void *data)
+{
+	int stat = pvr2_dvb_feed_func(data);
 	/* from videobuf-dvb.c: */
 	while (!kthread_should_stop()) {
 		set_current_state(TASK_INTERRUPTIBLE);
 		schedule();
 	}
-	return 0;
+	return stat;
 }
 
 static int pvr2_dvb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)