From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Linux Media Mailing List <linux-media@vger.kernel.org>,
royale@zerezo.com, USB <linux-usb@vger.kernel.org>,
syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
syzbot+b4d54814b339b5c6bbd4@syzkaller.appspotmail.com
Subject: [RFT][PATCH v1] media: zr364xx: Fix memory leak in ->probe()
Date: Wed, 30 Dec 2020 23:19:18 +0200 [thread overview]
Message-ID: <20201230211918.63508-1-andriy.shevchenko@linux.intel.com> (raw)
When ->probe() fails in some cases it may not free resources.
Replace few separated calls by v4l2_device_put() to clean up
everything.
Reported-by: syzbot+b4d54814b339b5c6bbd4@syzkaller.appspotmail.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
I have no hardware and hadn't done any test of this.
drivers/media/usb/zr364xx/zr364xx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c
index 1e1c6b4d1874..5b9e31af57cf 100644
--- a/drivers/media/usb/zr364xx/zr364xx.c
+++ b/drivers/media/usb/zr364xx/zr364xx.c
@@ -1533,9 +1533,7 @@ static int zr364xx_probe(struct usb_interface *intf,
return 0;
fail:
- v4l2_ctrl_handler_free(hdl);
- v4l2_device_unregister(&cam->v4l2_dev);
- kfree(cam);
+ v4l2_device_put(&cam->v4l2_dev);
return err;
}
--
2.29.2
next reply other threads:[~2020-12-30 21:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-30 21:19 Andy Shevchenko [this message]
2020-12-31 1:53 ` [RFT][PATCH v1] media: zr364xx: Fix memory leak in ->probe() Ezequiel Garcia
2020-12-31 1:53 ` syzbot
2021-01-05 14:00 ` Dan Carpenter
2021-01-05 14:37 ` Andy Shevchenko
2021-01-05 16:04 ` Dan Carpenter
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=20201230211918.63508-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=royale@zerezo.com \
--cc=syzbot+b4d54814b339b5c6bbd4@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;
as well as URLs for NNTP newsgroup(s).