]> git.hungrycats.org Git - linux/commitdiff
[PATCH] v4l use-after-free fix
authorAndrew Morton <akpm@osdl.org>
Sun, 31 Aug 2003 11:26:51 +0000 (04:26 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Sun, 31 Aug 2003 11:26:51 +0000 (04:26 -0700)
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

index 91a7970e93895935f39b1062ca38bf540531cab8..777f59a1f6c90727d79eda7eb07f34f399956a48 100644 (file)
@@ -349,9 +349,9 @@ void video_unregister_device(struct video_device *vfd)
        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);
 }