From: Greg KH <greg@kroah.com>

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.



 drivers/media/video/videodev.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/media/video/videodev.c~v4l-use-after-free-fix drivers/media/video/videodev.c
--- 25/drivers/media/video/videodev.c~v4l-use-after-free-fix	2003-08-22 11:24:06.000000000 -0700
+++ 25-akpm/drivers/media/video/videodev.c	2003-08-22 11:24:06.000000000 -0700
@@ -349,9 +349,9 @@ void video_unregister_device(struct vide
 	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);
 }
 

_