aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2010-05-14 23:15:38 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-06-01 00:19:52 -0400
commitd72baad3f0e59041d68db7524537046e3a4121a2 (patch)
tree80556b09be921c6cfee98c6c70595e86bf5f1060
parent8fd0444817e557568d8bddd77828d9ae0d606e04 (diff)
V4L/DVB: pvrusb2: Fix kernel oops at device unregistration
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 <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 5ffa0d2b0b0d..aaafa0398fd5 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)
883{ 883{
884 struct pvr2_hdw *hdw = dip->v4lp->channel.mc_head->hdw; 884 struct pvr2_hdw *hdw = dip->v4lp->channel.mc_head->hdw;
885 enum pvr2_config cfg = dip->config; 885 enum pvr2_config cfg = dip->config;
886 char msg[80];
887 unsigned int mcnt;
888
889 /* Construct the unregistration message *before* we actually
890 perform the unregistration step. By doing it this way we don't
891 have to worry about potentially touching deleted resources. */
892 mcnt = scnprintf(msg, sizeof(msg) - 1,
893 "pvrusb2: unregistered device %s [%s]",
894 video_device_node_name(&dip->devbase),
895 pvr2_config_get_name(cfg));
896 msg[mcnt] = 0;
886 897
887 pvr2_hdw_v4l_store_minor_number(hdw,dip->minor_type,-1); 898 pvr2_hdw_v4l_store_minor_number(hdw,dip->minor_type,-1);
888 899
@@ -894,9 +905,7 @@ static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip)
894 are gone. */ 905 are gone. */
895 video_unregister_device(&dip->devbase); 906 video_unregister_device(&dip->devbase);
896 907
897 printk(KERN_INFO "pvrusb2: unregistered device %s [%s]\n", 908 printk(KERN_INFO "%s\n", msg);
898 video_device_node_name(&dip->devbase),
899 pvr2_config_get_name(cfg));
900 909
901} 910}
902 911