mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
UPSTREAM: usb: gadget: uvc: fix sg handling during video encode
In uvc_video_encode_isoc_sg, the uvc_request's sg list is incorrectly being populated leading to corrupt video being received by the remote end. When building the sg list the usage of buf->sg's 'dma_length' field is not correct and instead its 'length' field should be used. Fixes:e81e7f9a0e("usb: gadget: uvc: add scatter gather support") Cc: <stable@vger.kernel.org> Signed-off-by: Jeff Vanhoof <qjv001@motorola.com> Signed-off-by: Dan Vacura <w36195@motorola.com> Link: https://lore.kernel.org/r/20221018215044.765044-5-w36195@motorola.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commitb57b08e6f4) Bug: 259171206 Change-Id: I6b6ee215676592e44dc1a12081efc049c3d50d4b Signed-off-by: Avichal Rakesh <arakesh@google.com>
This commit is contained in:
committed by
Avichal Rakesh
parent
6505cd47e1
commit
dfa0ad4a5d
@@ -157,10 +157,10 @@ uvc_video_encode_isoc_sg(struct usb_request *req, struct uvc_video *video,
|
||||
sg = sg_next(sg);
|
||||
|
||||
for_each_sg(sg, iter, ureq->sgt.nents - 1, i) {
|
||||
if (!len || !buf->sg || !sg_dma_len(buf->sg))
|
||||
if (!len || !buf->sg || !buf->sg->length)
|
||||
break;
|
||||
|
||||
sg_left = sg_dma_len(buf->sg) - buf->offset;
|
||||
sg_left = buf->sg->length - buf->offset;
|
||||
part = min_t(unsigned int, len, sg_left);
|
||||
|
||||
sg_set_page(iter, sg_page(buf->sg), part, buf->offset);
|
||||
|
||||
Reference in New Issue
Block a user