Skip to contentSkip to conversation

videobuf_qbuf: fix? possible videobuf_queue->stream corruption and lockup

PATCH Applied Oleg Nesterov 3 participants 3 messages Jan 23, 2007 – Feb 21, 2007 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 videobuf_qbuf: fix? possible videobuf_queue->stream corruption and lockup

I am pretty sure the bug is real, but the patch may be wrong, please review.

We are doing ->buf_prepare(buf) before adding buf to q->stream list. This means that videobuf_qbuf() should not try to re-add a STATE_PREPARED buffer.

drivers/media/video/video-buf.c renamed from drivers/media/video/video-buf.c~v4l_lockup +1 -0
@@ -700,6 +700,7 @@ videobuf_qbuf(struct videobuf_queue *q,
 		goto done;
 	}
 	if (buf->state == STATE_QUEUED ||
+	    buf->state == STATE_PREPARED ||
 	    buf->state == STATE_ACTIVE) {
 		dprintk(1,"qbuf: buffer is already queued or active.\n");
 		goto done;
#1 lore raw

Em Ter, 2007-01-23 às 20:57 +0300, Oleg Nesterov escreveu:

Quoted 6 lines

I am pretty sure the bug is real, but the patch may be wrong, please review.

We are doing ->buf_prepare(buf) before adding buf to q->stream list. This means that videobuf_qbuf() should not try to re-add a STATE_PREPARED buffer.

Chris/Adrian,

IMO, this should also be applied at -stable trees.

Quoted 12 lines
drivers/media/video/video-buf.c renamed from drivers/media/video/video-buf.c~v4l_lockup +1 -0
@@ -700,6 +700,7 @@ videobuf_qbuf(struct videobuf_queue *q,
 		goto done;
 	}
 	if (buf->state == STATE_QUEUED ||
+	    buf->state == STATE_PREPARED ||
 	    buf->state == STATE_ACTIVE) {
 		dprintk(1,"qbuf: buffer is already queued or active.\n");
 		goto done;
Applied
#2 lore raw
Quoted 6 lines · Mauro Carvalho Chehab

Em Ter, 2007-01-23 às 20:57 +0300, Oleg Nesterov escreveu:

Quoted 5 lines

I am pretty sure the bug is real, but the patch may be wrong, please review.

We are doing ->buf_prepare(buf) before adding buf to q->stream list. This means that videobuf_qbuf() should not try to re-add a STATE_PREPARED buffer.

Quoted 7 lines
Quoted 1 line

Chris/Adrian,

IMO, this should also be applied at -stable trees.
...

Thanks, applied to 2.6.16 (a trivial backport was required since the dprintk() was added after 2.6.16).

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed