[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240302230702.1207-1-hdanton@sina.com>
Date: Sun, 3 Mar 2024 07:07:02 +0800
From: Hillf Danton <hdanton@...a.com>
To: syzbot <syzbot+b2391895514ed9ef4a8e@...kaller.appspotmail.com>
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: KASAN: use-after-free Read in v4l2_fh_open
On Mon, 15 Feb 2021 07:18:22 -0800
> syzbot found the following issue on:
>
> HEAD commit: 291009f6 Merge tag 'pm-5.11-rc8' of git://git.kernel.org/p..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17179dd4d00000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
--- x/drivers/media/usb/em28xx/em28xx-video.c
+++ y/drivers/media/usb/em28xx/em28xx-video.c
@@ -2152,6 +2152,10 @@ static int em28xx_v4l2_open(struct file
if (mutex_lock_interruptible(&dev->lock))
return -ERESTARTSYS;
+ if (!dev->v4l2) {
+ mutex_unlock(&dev->lock);
+ return -ENODEV;
+ }
ret = v4l2_fh_open(filp);
if (ret) {
dev_err(&dev->intf->dev,
@@ -2161,6 +2165,7 @@ static int em28xx_v4l2_open(struct file
return ret;
}
+ v4l2 = dev->v4l2;
if (v4l2->users == 0) {
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
@@ -2899,6 +2904,7 @@ unregister_dev:
v4l2_ctrl_handler_free(&v4l2->ctrl_handler);
v4l2_device_unregister(&v4l2->v4l2_dev);
err:
+ video_unregister_device(&v4l2->vdev);
dev->v4l2 = NULL;
kref_put(&v4l2->ref, em28xx_free_v4l2);
mutex_unlock(&dev->lock);
--
Powered by blists - more mailing lists