Skip to contentSkip to conversation

Fix bug in v4l core for 2.6.0-test3-bk

PATCH New Greg KH 1 participant 1 message Aug 22, 2003 Media (V4L/DVB)

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 Fix bug in v4l core for 2.6.0-test3-bk

Hi,

When working on converting the usb v4l drivers to the new v4l class changes, I ran into this nasty bug. Seems that the core was using a structure after it had been freed. The patch below fixes it.

If you don't mind, I'll include it with some USB patches in a send to Linus, as my USB fixes will not work without it.

thanks,

greg k-h

# V4L: fix use after free bug in v4l core.

drivers/media/video/videodev.c +1 -1
diff -Nru a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
@@ -349,9 +349,9 @@
 	if(video_device[vfd->minor]!=vfd)
 		panic("videodev: bad unregister");
 
-	class_device_unregister(&vfd->class_dev);
 	devfs_remove(vfd->devfs_name);
 	video_device[vfd->minor]=NULL;
+	class_device_unregister(&vfd->class_dev);
 	up(&videodev_lock);
 }