Re: [PATCH v6 4/4] usb: gadget: uvc: Fix use-after-free for inflight usb_requests

From: kernel test robot
Date: Thu Oct 19 2023 - 16:32:38 EST


Hi Avichal,

kernel test robot noticed the following build warnings:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on usb/usb-next usb/usb-linus linus/master v6.6-rc6 next-20231019]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Avichal-Rakesh/usb-gadget-uvc-prevent-use-of-disabled-endpoint/20231020-025512
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20231019185319.2714000-5-arakesh%40google.com
patch subject: [PATCH v6 4/4] usb: gadget: uvc: Fix use-after-free for inflight usb_requests
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231020/202310200457.GwPPFuHX-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231020/202310200457.GwPPFuHX-lkp@xxxxxxxxx/reproduce)

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310200457.GwPPFuHX-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/usb/gadget/function/uvc_video.c:231: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* Must be called with req_lock held as it modifies the list ureq is held in


vim +231 drivers/usb/gadget/function/uvc_video.c

225
226 /* --------------------------------------------------------------------------
227 * Request handling
228 */
229
230 /**
> 231 * Must be called with req_lock held as it modifies the list ureq is held in
232 */
233 static void
234 uvc_video_free_request(struct uvc_request *ureq, struct usb_ep *ep)
235 {
236 sg_free_table(&ureq->sgt);
237 if (ureq->req && ep) {
238 usb_ep_free_request(ep, ureq->req);
239 ureq->req = NULL;
240 }
241
242 kfree(ureq->req_buffer);
243 ureq->req_buffer = NULL;
244
245 if (!list_empty(&ureq->list))
246 list_del_init(&ureq->list);
247
248 kfree(ureq);
249 }
250

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki