From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Jie Deng <dengjie03@kylinos.cn>,
laurent.pinchart@ideasonboard.com
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev, hansg@kernel.org,
mchehab@kernel.org, kieran.bingham@ideasonboard.com,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Jie Deng <dengjie03@kylinos.cn>
Subject: Re: [PATCH v2] media: usb: uvc: Fix NULL pointer dereference during USB device hot-unplug
Date: Sat, 29 Nov 2025 19:48:49 +0300 [thread overview]
Message-ID: <202511290057.kQLrar4L-lkp@intel.com> (raw)
In-Reply-To: <20251122072558.2604753-1-dengjie03@kylinos.cn>
Hi Jie,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Jie-Deng/media-usb-uvc-Fix-NULL-pointer-dereference-during-USB-device-hot-unplug/20251122-152814
base: https://git.linuxtv.org/media-ci/media-pending.git master
patch link: https://lore.kernel.org/r/20251122072558.2604753-1-dengjie03%40kylinos.cn
patch subject: [PATCH v2] media: usb: uvc: Fix NULL pointer dereference during USB device hot-unplug
config: x86_64-randconfig-r071-20251128 (https://download.01.org/0day-ci/archive/20251129/202511290057.kQLrar4L-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202511290057.kQLrar4L-lkp@intel.com/
smatch warnings:
drivers/media/usb/uvc/uvc_video.c:2357 uvc_video_stop_streaming() error: we previously assumed 'stream' could be null (see line 2323)
vim +/stream +2357 drivers/media/usb/uvc/uvc_video.c
571e70dbd421056 Kieran Bingham 2018-11-05 2318 void uvc_video_stop_streaming(struct uvc_streaming *stream)
571e70dbd421056 Kieran Bingham 2018-11-05 2319 {
18ffa9a4cf426a8 Jie Deng 2025-11-22 2320 struct usb_host_config *config;
18ffa9a4cf426a8 Jie Deng 2025-11-22 2321 int i;
18ffa9a4cf426a8 Jie Deng 2025-11-22 2322
18ffa9a4cf426a8 Jie Deng 2025-11-22 @2323 if (!stream || !stream->dev || !stream->dev->udev || !stream->intf)
I don't think "stream" can be NULL,
18ffa9a4cf426a8 Jie Deng 2025-11-22 2324 goto cleanup_clock;
18ffa9a4cf426a8 Jie Deng 2025-11-22 2325
fb58e16bb783833 Kieran Bingham 2018-11-05 2326 uvc_video_stop_transfer(stream, 1);
571e70dbd421056 Kieran Bingham 2018-11-05 2327
18ffa9a4cf426a8 Jie Deng 2025-11-22 2328 config = stream->dev->udev->actconfig;
18ffa9a4cf426a8 Jie Deng 2025-11-22 2329 if (stream->intf->num_altsetting > 1 && config) {
18ffa9a4cf426a8 Jie Deng 2025-11-22 2330 /* Security Check: Check if the interface exists and is valid */
18ffa9a4cf426a8 Jie Deng 2025-11-22 2331 for (i = 0; i < config->desc.bNumInterfaces; i++) {
18ffa9a4cf426a8 Jie Deng 2025-11-22 2332 if (config->interface[i] &&
18ffa9a4cf426a8 Jie Deng 2025-11-22 2333 config->interface[i]->altsetting[0]
18ffa9a4cf426a8 Jie Deng 2025-11-22 2334 .desc.bInterfaceNumber == stream->intfnum) {
571e70dbd421056 Kieran Bingham 2018-11-05 2335 usb_set_interface(stream->dev->udev, stream->intfnum, 0);
18ffa9a4cf426a8 Jie Deng 2025-11-22 2336 break;
18ffa9a4cf426a8 Jie Deng 2025-11-22 2337 }
18ffa9a4cf426a8 Jie Deng 2025-11-22 2338 }
571e70dbd421056 Kieran Bingham 2018-11-05 2339 } else {
699b9a86a3f03ad Laurent Pinchart 2022-06-08 2340 /*
699b9a86a3f03ad Laurent Pinchart 2022-06-08 2341 * UVC doesn't specify how to inform a bulk-based device
571e70dbd421056 Kieran Bingham 2018-11-05 2342 * when the video stream is stopped. Windows sends a
571e70dbd421056 Kieran Bingham 2018-11-05 2343 * CLEAR_FEATURE(HALT) request to the video streaming
571e70dbd421056 Kieran Bingham 2018-11-05 2344 * bulk endpoint, mimic the same behaviour.
571e70dbd421056 Kieran Bingham 2018-11-05 2345 */
571e70dbd421056 Kieran Bingham 2018-11-05 2346 unsigned int epnum = stream->header.bEndpointAddress
571e70dbd421056 Kieran Bingham 2018-11-05 2347 & USB_ENDPOINT_NUMBER_MASK;
571e70dbd421056 Kieran Bingham 2018-11-05 2348 unsigned int dir = stream->header.bEndpointAddress
571e70dbd421056 Kieran Bingham 2018-11-05 2349 & USB_ENDPOINT_DIR_MASK;
571e70dbd421056 Kieran Bingham 2018-11-05 2350 unsigned int pipe;
571e70dbd421056 Kieran Bingham 2018-11-05 2351
571e70dbd421056 Kieran Bingham 2018-11-05 2352 pipe = usb_sndbulkpipe(stream->dev->udev, epnum) | dir;
571e70dbd421056 Kieran Bingham 2018-11-05 2353 usb_clear_halt(stream->dev->udev, pipe);
571e70dbd421056 Kieran Bingham 2018-11-05 2354 }
571e70dbd421056 Kieran Bingham 2018-11-05 2355
18ffa9a4cf426a8 Jie Deng 2025-11-22 2356 cleanup_clock:
141270bd95d48ea Ricardo Ribalda 2024-03-23 @2357 uvc_video_clock_cleanup(&stream->clock);
^^^^^^^^^^^^^^
But if it is then we are toasted.
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2025-11-29 16:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-22 7:25 [PATCH v2] media: usb: uvc: Fix NULL pointer dereference during USB device hot-unplug Jie Deng
2025-11-22 8:17 ` Ricardo Ribalda
2025-11-24 3:07 ` Jie Deng
2025-11-24 9:06 ` Ricardo Ribalda
2025-11-25 3:14 ` Jie Deng
2025-11-25 8:29 ` Ricardo Ribalda
2025-11-26 6:43 ` Jie Deng
2025-11-29 16:48 ` Dan Carpenter [this message]
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=202511290057.kQLrar4L-lkp@intel.com \
--to=dan.carpenter@linaro.org \
--cc=dengjie03@kylinos.cn \
--cc=hansg@kernel.org \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mchehab@kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
/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