From: syzbot <syzbot+54648a6c1187a7ef46a6@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Forwarded: [PATCH] media: em28xx: fix v4l2 use-after-free after failed init
Date: Sun, 01 Nov 2026 12:37:06 -0800 [thread overview]
Message-ID: <6ae7a2f2.64e51036.15cf6a.001c.GAE@google.com> (raw)
In-Reply-To: <6ae78458.64e51036.15cf6a.0015.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH] media: em28xx: fix v4l2 use-after-free after failed init
Author: drifabdelmalekmohamedsaid@gmail.com
#syz test
---
drivers/media/usb/em28xx/em28xx-video.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 84424284d486..924a3f7977c9 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -2414,7 +2414,7 @@ static int em28xx_v4l2_open(struct file *filp)
*/
static int em28xx_v4l2_fini(struct em28xx *dev)
{
- struct em28xx_v4l2 *v4l2 = dev->v4l2;
+ struct em28xx_v4l2 *v4l2;
if (dev->is_audio_only) {
/* Shouldn't initialize IR for this interface */
@@ -2426,13 +2426,17 @@ static int em28xx_v4l2_fini(struct em28xx *dev)
return 0;
}
- if (!v4l2)
- return 0;
-
dev_info(&dev->intf->dev, "Closing video extension\n");
mutex_lock(&dev->lock);
+ /* matches em28xx_v4l2_init error paths */
+ v4l2 = dev->v4l2;
+ if (!v4l2){
+ mutex_unlock(&dev->lock);
+ return 0;
+ }
+
v4l2_device_disconnect(&v4l2->v4l2_dev);
em28xx_uninit_usb_xfer(dev, EM28XX_ANALOG_MODE);
@@ -3129,6 +3133,9 @@ static int em28xx_v4l2_init(struct em28xx *dev)
vb2_video_unregister_device(&v4l2->vdev);
}
+ /* matches check in em28xx_v4l2_fini (under the same lock) */
+ dev->v4l2 = NULL;
+
mutex_unlock(&dev->lock);
/*
--
2.43.0
next prev parent reply other threads:[~2026-11-01 20:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 18:26 [syzbot] [media?] [usb?] KASAN: slab-use-after-free Read in dev_dbg_obj syzbot
2026-11-01 20:37 ` syzbot [this message]
2026-11-02 10:37 ` Forwarded: [PATCH] media: em28xx: clear dev->v4l2 on v4l2 init failure syzbot
2026-11-02 12:03 ` syzbot
-- strict thread matches above, loose matches on Subject: below --
2026-10-31 3:29 [syzbot] [media?] [usb?] KASAN: slab-use-after-free Read in v4l2_device_disconnect syzbot
2026-11-01 20:36 ` Forwarded: [PATCH] media: em28xx: fix v4l2 use-after-free after failed init syzbot
2026-10-22 0:29 [syzbot] [media?] [usb?] kernel BUG in v4l2_device_put syzbot
2026-11-01 20:39 ` Forwarded: [PATCH] media: em28xx: fix v4l2 use-after-free after failed init syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6ae7a2f2.64e51036.15cf6a.001c.GAE@google.com \
--to=syzbot+54648a6c1187a7ef46a6@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.