This is a note to let you know that I've just added the patch titled usb: gadget: uvc: improve sg exit condition to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: usb-gadget-uvc-improve-sg-exit-condition.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From aef11279888c00e1841a3533a35d279285af3a51 Mon Sep 17 00:00:00 2001 From: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx> Date: Sun, 3 Apr 2022 01:27:44 +0200 Subject: usb: gadget: uvc: improve sg exit condition From: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx> commit aef11279888c00e1841a3533a35d279285af3a51 upstream. The exit condition to quit iterating over the sg_list, while encoding the sg entries, has to consider the case that the dma_len of the entry could be zero. This patch takes this condition to account. Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20220402232744.3622565-4-m.grzeschik@xxxxxxxxxxxxxx Cc: Dan Vacura <w36195@xxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/usb/gadget/function/uvc_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c @@ -126,7 +126,7 @@ uvc_video_encode_isoc_sg(struct usb_requ sg = sg_next(sg); for_each_sg(sg, iter, ureq->sgt.nents - 1, i) { - if (!len || !buf->sg) + if (!len || !buf->sg || !sg_dma_len(buf->sg)) break; sg_left = sg_dma_len(buf->sg) - buf->offset; Patches currently in stable-queue which might be from m.grzeschik@xxxxxxxxxxxxxx are queue-5.15/usb-gadget-uvc-improve-sg-exit-condition.patch queue-5.15/usb-gadget-uvc-rework-uvcg_queue_next_buffer-to-uvcg_complete_buffer.patch queue-5.15/usb-gadget-uvc-giveback-vb2-buffer-on-req-complete.patch queue-5.15/usb-gadget-uvc-consistently-use-define-for-headerlen.patch queue-5.15/usb-gadget-uvc-use-on-returned-header-len-in-video_encode_isoc_sg.patch