From: shaurya <ssranevjti@gmail.com>
To: syzbot+a41b73dce23962a74c72@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-usb@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [media?] [usb?] memory leak in v4l2_ctrl_handler_init_class (2)
Date: Wed, 26 Nov 2025 01:51:04 +0530 [thread overview]
Message-ID: <50389e6f-a379-44cd-a18b-ded86d0b9f7e@gmail.com> (raw)
In-Reply-To: <692560ec.a70a0220.2ea503.0087.GAE@google.com>
[-- Attachment #1: Type: text/plain, Size: 82 bytes --]
#syz test:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
[-- Attachment #2: 0001-media-radio-keene-fix-memory-leak-in-error-path.patch --]
[-- Type: text/x-patch, Size: 1925 bytes --]
From 0b4eb46c6f9f4dbf9dc9d9b07a5bc8b5ece04b8d Mon Sep 17 00:00:00 2001
From: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
Date: Wed, 26 Nov 2025 01:47:41 +0530
Subject: [PATCH] media: radio-keene: fix memory leak in error path
Fix a memory leak in usb_keene_probe() when v4l2_device_register()
fails. The v4l2 control handler was initialized and controls were
added, but if v4l2_device_register() failed, the handler was never
freed, leaking the allocated memory for the handler buckets and
control structures.
Consolidate the error handling by adding an err_hdl label that
ensures v4l2_ctrl_handler_free() is called for all error paths
after the handler is initialized.
Reported-by: syzbot+a41b73dce23962a74c72@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=a41b73dce23962a74c72
Fixes: fc39f46b8e82 ("[media] radio-keene: add a driver for the Keene FM Transmitter")
Signed-off-by: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
---
drivers/media/radio/radio-keene.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/radio/radio-keene.c b/drivers/media/radio/radio-keene.c
index f3b57f0cb1ec..84916b5ebcb2 100644
--- a/drivers/media/radio/radio-keene.c
+++ b/drivers/media/radio/radio-keene.c
@@ -337,14 +337,12 @@ static int usb_keene_probe(struct usb_interface *intf,
radio->stereo = true;
if (hdl->error) {
retval = hdl->error;
-
- v4l2_ctrl_handler_free(hdl);
- goto err_v4l2;
+ goto err_hdl;
}
retval = v4l2_device_register(&intf->dev, &radio->v4l2_dev);
if (retval < 0) {
dev_err(&intf->dev, "couldn't register v4l2_device\n");
- goto err_v4l2;
+ goto err_hdl;
}
mutex_init(&radio->lock);
@@ -383,6 +381,8 @@ static int usb_keene_probe(struct usb_interface *intf,
err_vdev:
v4l2_device_unregister(&radio->v4l2_dev);
+err_hdl:
+ v4l2_ctrl_handler_free(&radio->hdl);
err_v4l2:
kfree(radio->buffer);
kfree(radio);
--
2.34.1
next prev parent reply other threads:[~2025-11-25 20:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 7:55 syzbot
2025-11-25 17:01 ` shaurya
2025-11-25 20:38 ` syzbot
2025-11-25 17:03 ` shaurya
2025-11-25 21:09 ` syzbot
2025-11-25 20:21 ` shaurya [this message]
2025-11-25 21:29 ` 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=50389e6f-a379-44cd-a18b-ded86d0b9f7e@gmail.com \
--to=ssranevjti@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=syzbot+a41b73dce23962a74c72@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®