提交 e4e70a14 编写于 作者: L Laurent Pinchart 提交者: Mauro Carvalho Chehab

[media] v4l: vsp1: Prevent pipelines from running when not streaming

Pipelines can only be run if all their video nodes are streaming. Commit
b4dfb9b3 ("[media] v4l: vsp1: Stop the pipeline upon the first
STREAMOFF") fixed the pipeline stop sequence, but introduced a race
condition that makes it possible to run a pipeline after stopping the
stream on a video node by queuing a buffer on the other side of the
pipeline.

Fix this by clearing the buffers ready flag when stopping the stream,
which will prevent the QBUF handler from running the pipeline.

Fixes: b4dfb9b3 ("[media] v4l: vsp1: Stop the pipeline upon the first STREAMOFF")
Reported-by: NKieran Bingham <kieran@bingham.xyz>
Tested-by: NKieran Bingham <kieran@bingham.xyz>
Signed-off-by: NLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 3c3ba545
......@@ -675,6 +675,13 @@ static void vsp1_video_stop_streaming(struct vb2_queue *vq)
unsigned long flags;
int ret;
/* Clear the buffers ready flag to make sure the device won't be started
* by a QBUF on the video node on the other side of the pipeline.
*/
spin_lock_irqsave(&video->irqlock, flags);
pipe->buffers_ready &= ~(1 << video->pipe_index);
spin_unlock_irqrestore(&video->irqlock, flags);
mutex_lock(&pipe->lock);
if (--pipe->stream_count == pipe->num_inputs) {
/* Stop the pipeline. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册