summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@kernel.org>2008-09-03 17:12:25 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-09-03 18:37:53 -0300
commit8da9bae3292ea8aee803e7cda295877c361f0694 (patch)
treeb50317e39edf3f0d92e704bdfd87b0ea58f78fb1 /drivers
parent9a0c04a1ee3b4df6a30ae6975e13c558908df400 (diff)
downloadlinux-3.10-8da9bae3292ea8aee803e7cda295877c361f0694.tar.gz
linux-3.10-8da9bae3292ea8aee803e7cda295877c361f0694.tar.bz2
linux-3.10-8da9bae3292ea8aee803e7cda295877c361f0694.zip
V4L/DVB (8842): vivi_release(): fix use-after-free
video_device_release() does kfree(), which made the following printk() doing a use-after-free. printk() first and release then. Reported-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/vivi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index f55d77db155..8ba8daafd7e 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -1021,13 +1021,13 @@ static int vivi_release(void)
dev = list_entry(list, struct vivi_dev, vivi_devlist);
if (-1 != dev->vfd->minor) {
- video_unregister_device(dev->vfd);
- printk(KERN_INFO "%s: /dev/video%d unregistered.\n",
+ printk(KERN_INFO "%s: unregistering /dev/video%d\n",
VIVI_MODULE_NAME, dev->vfd->minor);
+ video_unregister_device(dev->vfd);
} else {
- video_device_release(dev->vfd);
- printk(KERN_INFO "%s: /dev/video%d released.\n",
+ printk(KERN_INFO "%s: releasing /dev/video%d\n",
VIVI_MODULE_NAME, dev->vfd->minor);
+ video_device_release(dev->vfd);
}
kfree(dev);