Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a3f0ede authored by Jayakrishnan Memana's avatar Jayakrishnan Memana Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarJayakrishnan Memana <jayakrishnan.memana@maxim-ic.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 8762541f
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -338,6 +338,7 @@ struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
	if ((queue->flags & UVC_QUEUE_DROP_CORRUPTED) && buf->error) {
	if ((queue->flags & UVC_QUEUE_DROP_CORRUPTED) && buf->error) {
		buf->error = 0;
		buf->error = 0;
		buf->state = UVC_BUF_STATE_QUEUED;
		buf->state = UVC_BUF_STATE_QUEUED;
		buf->bytesused = 0;
		vb2_set_plane_payload(&buf->buf, 0, 0);
		vb2_set_plane_payload(&buf->buf, 0, 0);
		return buf;
		return buf;
	}
	}