[media] uvcvideo: Reset the bytesused field when recycling an erroneous buffer
authorJayakrishnan Memana <jayakrishnan.memana@maxim-ic.com>
Sun, 15 Jul 2012 13:54:03 +0000 (10:54 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 11 Aug 2012 15:58:16 +0000 (12:58 -0300)
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>
drivers/media/video/uvc/uvc_queue.c

index 9288fbd5001b26e8bcf3210ffbfc0da7891f1182..5577381b5bf057357c6c4f591e4eb09269c2eb38 100644 (file)
@@ -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) {
                buf->error = 0;
                buf->state = UVC_BUF_STATE_QUEUED;
+               buf->bytesused = 0;
                vb2_set_plane_payload(&buf->buf, 0, 0);
                return buf;
        }
This page took 0.025058 seconds and 5 git commands to generate.