From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Guenter Roeck <linux@roeck-us.net>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, Sakari Ailus <sakari.ailus@iki.fi>,
linux-uvc-devel@lists.sourceforge.net, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>,
Alan Stern <stern@rowland.harvard.edu>,
Hans Verkuil <hverkuil@xs4all.nl>
Subject: [kbuild] Re: [PATCH v2 5/5] media: uvcvideo: Abort uvc_v4l2_open if video device is unregistered
Date: Wed, 9 Sep 2020 15:19:41 +0300 [thread overview]
Message-ID: <20200909121941.GY8321@kadam> (raw)
In-Reply-To: <20200908194557.198335-6-linux@roeck-us.net>
[-- Attachment #1: Type: text/plain, Size: 6279 bytes --]
Hi Guenter,
url: https://github.com/0day-ci/linux/commits/Guenter-Roeck/media-uvcvideo-Fix-race-conditions/20200909-121927
base: git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-m001-20200909 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/media/usb/uvc/uvc_v4l2.c:553 uvc_v4l2_open() warn: possible memory leak of 'handle'
# https://github.com/0day-ci/linux/commit/50911975ff9b21d08ff5408e496683b8ac567b1c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Guenter-Roeck/media-uvcvideo-Fix-race-conditions/20200909-121927
git checkout 50911975ff9b21d08ff5408e496683b8ac567b1c
vim +/handle +553 drivers/media/usb/uvc/uvc_v4l2.c
bec43661b1dc00 drivers/media/video/uvc/uvc_v4l2.c Hans Verkuil 2008-12-30 530 static int uvc_v4l2_open(struct file *file)
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 531 {
35f02a681b72ec drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-06-28 532 struct uvc_streaming *stream;
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 533 struct uvc_fh *handle;
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 534 int ret = 0;
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 535
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 536 uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_open\n");
35f02a681b72ec drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-06-28 537 stream = video_drvdata(file);
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 538
35f02a681b72ec drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-06-28 539 ret = usb_autopm_get_interface(stream->dev->intf);
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 540 if (ret < 0)
716fdee110ceb8 drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-09-29 541 return ret;
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 542
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 543 /* Create the device handle. */
f14d4988c28e52 drivers/media/usb/uvc/uvc_v4l2.c Laurent Pinchart 2018-01-16 544 handle = kzalloc(sizeof(*handle), GFP_KERNEL);
^^^^^^^^^^^^^^^^
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 545 if (handle == NULL) {
35f02a681b72ec drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-06-28 546 usb_autopm_put_interface(stream->dev->intf);
716fdee110ceb8 drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-09-29 547 return -ENOMEM;
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 548 }
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 549
17706f5653a90f drivers/media/usb/uvc/uvc_v4l2.c Laurent Pinchart 2013-04-25 550 mutex_lock(&stream->dev->lock);
50911975ff9b21 drivers/media/usb/uvc/uvc_v4l2.c Guenter Roeck 2020-09-08 551 if (!video_is_registered(&stream->vdev)) {
50911975ff9b21 drivers/media/usb/uvc/uvc_v4l2.c Guenter Roeck 2020-09-08 552 mutex_unlock(&stream->dev->lock);
50911975ff9b21 drivers/media/usb/uvc/uvc_v4l2.c Guenter Roeck 2020-09-08 @553 return -ENODEV;
^^^^^^^^^^^^^^
kfree(handle);
50911975ff9b21 drivers/media/usb/uvc/uvc_v4l2.c Guenter Roeck 2020-09-08 554 }
17706f5653a90f drivers/media/usb/uvc/uvc_v4l2.c Laurent Pinchart 2013-04-25 555 if (stream->dev->users == 0) {
17706f5653a90f drivers/media/usb/uvc/uvc_v4l2.c Laurent Pinchart 2013-04-25 556 ret = uvc_status_start(stream->dev, GFP_KERNEL);
35f02a681b72ec drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-06-28 557 if (ret < 0) {
17706f5653a90f drivers/media/usb/uvc/uvc_v4l2.c Laurent Pinchart 2013-04-25 558 mutex_unlock(&stream->dev->lock);
a82a45f65377b0 drivers/media/usb/uvc/uvc_v4l2.c Oliver Neukum 2013-01-10 559 usb_autopm_put_interface(stream->dev->intf);
04a37e0f32f988 drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-05-19 560 kfree(handle);
716fdee110ceb8 drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-09-29 561 return ret;
04a37e0f32f988 drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-05-19 562 }
04a37e0f32f988 drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-05-19 563 }
04a37e0f32f988 drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-05-19 564
17706f5653a90f drivers/media/usb/uvc/uvc_v4l2.c Laurent Pinchart 2013-04-25 565 stream->dev->users++;
17706f5653a90f drivers/media/usb/uvc/uvc_v4l2.c Laurent Pinchart 2013-04-25 566 mutex_unlock(&stream->dev->lock);
17706f5653a90f drivers/media/usb/uvc/uvc_v4l2.c Laurent Pinchart 2013-04-25 567
d8da7513bcf983 drivers/media/usb/uvc/uvc_v4l2.c Hans Verkuil 2015-03-09 568 v4l2_fh_init(&handle->vfh, &stream->vdev);
b4012002f3a398 drivers/media/video/uvc/uvc_v4l2.c Hans de Goede 2012-04-08 569 v4l2_fh_add(&handle->vfh);
8e113595edf074 drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-07-01 570 handle->chain = stream->chain;
35f02a681b72ec drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-06-28 571 handle->stream = stream;
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 572 handle->state = UVC_HANDLE_PASSIVE;
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 573 file->private_data = handle;
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 574
716fdee110ceb8 drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2009-09-29 575 return 0;
c0efd232929c2c drivers/media/video/uvc/uvc_v4l2.c Laurent Pinchart 2008-06-30 576 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49876 bytes --]
[-- Attachment #3: Type: text/plain, Size: 149 bytes --]
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org
next prev parent reply other threads:[~2020-09-09 12:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 19:45 [PATCH v2 0/5] media: uvcvideo: Fix race conditions Guenter Roeck
2020-09-08 19:45 ` [PATCH v2 1/5] media: uvcvideo: Cancel async worker earlier Guenter Roeck
2020-09-08 19:45 ` [PATCH v2 2/5] media: uvcvideo: Lock video streams and queues while unregistering Guenter Roeck
2020-09-08 19:45 ` [PATCH v2 3/5] media: uvcvideo: Release stream queue when unregistering video device Guenter Roeck
2020-09-08 19:45 ` [PATCH v2 4/5] media: uvcvideo: Protect uvc queue file operations against disconnect Guenter Roeck
2020-09-08 19:45 ` [PATCH v2 5/5] media: uvcvideo: Abort uvc_v4l2_open if video device is unregistered Guenter Roeck
2020-09-09 12:19 ` Dan Carpenter [this message]
2020-09-09 15:13 ` [kbuild] " Guenter Roeck
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=20200909121941.GY8321@kadam \
--to=dan.carpenter@oracle.com \
--cc=hverkuil@xs4all.nl \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-uvc-devel@lists.sourceforge.net \
--cc=linux@roeck-us.net \
--cc=lkp@intel.com \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@iki.fi \
--cc=stern@rowland.harvard.edu \
/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).