Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: <stable@vger.kernel.org>
Signed-off-by: Jayakrishnan Memana <jayakrishnan.memana@maxim-ic.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Jayakrishnan Memana and committed by
Mauro Carvalho Chehab
8a3f0ede 8762541f

+1
+1
drivers/media/video/uvc/uvc_queue.c
··· 338 338 if ((queue->flags & UVC_QUEUE_DROP_CORRUPTED) && buf->error) { 339 339 buf->error = 0; 340 340 buf->state = UVC_BUF_STATE_QUEUED; 341 + buf->bytesused = 0; 341 342 vb2_set_plane_payload(&buf->buf, 0, 0); 342 343 return buf; 343 344 }