Skip to content

Commit 8a3f0ed

Browse files
Jayakrishnan MemanaMauro Carvalho Chehab
authored andcommitted
[media] uvcvideo: Reset the bytesused field when recycling an erroneous buffer
Buffers marked as erroneous are recycled immediately by the driver if the nodrop module parameter isn't set. The buffer payload size is reset to 0, but the buffer bytesused field isn't. This results in the buffer being immediately considered as complete, leading to an infinite loop in interrupt context. Fix the problem by resetting the bytesused field when recycling the buffer. Cc: <[email protected]> Signed-off-by: Jayakrishnan Memana <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 8762541 commit 8a3f0ed

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/media/video/uvc/uvc_queue.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
338338
if ((queue->flags & UVC_QUEUE_DROP_CORRUPTED) && buf->error) {
339339
buf->error = 0;
340340
buf->state = UVC_BUF_STATE_QUEUED;
341+
buf->bytesused = 0;
341342
vb2_set_plane_payload(&buf->buf, 0, 0);
342343
return buf;
343344
}

0 commit comments

Comments
 (0)