From 1914e147a929348978871e97886ef397c4d78a0a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 4 May 2007 12:19:59 -0300 Subject: V4L: Prevent queueing queued buffers. From: Sakari Ailus videobuf_qbuf queues buffers to q->stream but does not properly check the state of the buffer before queueing. It was possible to queue buffers that already were in the queue. Only buffers that are in states STATE_NEEDS_INIT and STATE_IDLE can be queued. Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/video-buf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/video-buf.c b/linux/drivers/media/video/video-buf.c index 5564e20af..c053375bb 100644 --- a/linux/drivers/media/video/video-buf.c +++ b/linux/drivers/media/video/video-buf.c @@ -708,9 +708,7 @@ videobuf_qbuf(struct videobuf_queue *q, dprintk(1,"qbuf: memory type is wrong.\n"); goto done; } - if (buf->state == STATE_QUEUED || - buf->state == STATE_PREPARED || - buf->state == STATE_ACTIVE) { + if (buf->state != STATE_NEEDS_INIT && buf->state != STATE_IDLE) { dprintk(1,"qbuf: buffer is already queued or active.\n"); goto done; } -- cgit v1.2.3