Skip to content

Commit b57b08e

Browse files
Jeff Vanhoofgregkh
authored andcommitted
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: e81e7f9 ("usb: gadget: uvc: add scatter gather support") Cc: <[email protected]> Signed-off-by: Jeff Vanhoof <[email protected]> Signed-off-by: Dan Vacura <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0a0a276 commit b57b08e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/usb/gadget/function/uvc_video.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ uvc_video_encode_isoc_sg(struct usb_request *req, struct uvc_video *video,
157157
sg = sg_next(sg);
158158

159159
for_each_sg(sg, iter, ureq->sgt.nents - 1, i) {
160-
if (!len || !buf->sg || !sg_dma_len(buf->sg))
160+
if (!len || !buf->sg || !buf->sg->length)
161161
break;
162162

163-
sg_left = sg_dma_len(buf->sg) - buf->offset;
163+
sg_left = buf->sg->length - buf->offset;
164164
part = min_t(unsigned int, len, sg_left);
165165

166166
sg_set_page(iter, sg_page(buf->sg), part, buf->offset);

0 commit comments

Comments
 (0)