This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-dvb.git tree:

Subject: V4L/DVB: pvrusb2: Fix kernel oops at device unregistration
Author:  Mike Isely <[email protected]>
Date:    Sat May 15 00:15:38 2010 -0300

pvrusb2: Fix oops caused by touching deleted memory after
unregistration.  This bug was introduced when we had started using
video_device_node_name() - that function was being called potentially
after the underlying structure (referenced by that function) had been
deleted.  The fix rearranges things slightly so that the function is
called before destruction takes place.

Signed-off-by: Mike Isely <[email protected]>
Cc: [email protected]
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/video/pvrusb2/pvrusb2-v4l2.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

---

http://git.linuxtv.org/v4l-dvb.git?a=commitdiff;h=981fc6165956fcf2613dde22be99077a5630c4b0

diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c 
b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 5ffa0d2..aaafa03 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -883,6 +883,17 @@ static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev 
*dip)
 {
        struct pvr2_hdw *hdw = dip->v4lp->channel.mc_head->hdw;
        enum pvr2_config cfg = dip->config;
+       char msg[80];
+       unsigned int mcnt;
+
+       /* Construct the unregistration message *before* we actually
+          perform the unregistration step.  By doing it this way we don't
+          have to worry about potentially touching deleted resources. */
+       mcnt = scnprintf(msg, sizeof(msg) - 1,
+                        "pvrusb2: unregistered device %s [%s]",
+                        video_device_node_name(&dip->devbase),
+                        pvr2_config_get_name(cfg));
+       msg[mcnt] = 0;
 
        pvr2_hdw_v4l_store_minor_number(hdw,dip->minor_type,-1);
 
@@ -894,9 +905,7 @@ static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip)
           are gone. */
        video_unregister_device(&dip->devbase);
 
-       printk(KERN_INFO "pvrusb2: unregistered device %s [%s]\n",
-              video_device_node_name(&dip->devbase),
-              pvr2_config_get_name(cfg));
+       printk(KERN_INFO "%s\n", msg);
 
 }
 

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to