Skip to contentSkip to conversation

Patch "[media] v4l: vsp1: Prevent pipelines from running when not streaming" has been added to the 4.8-stable tree

PATCH [email protected] 1 participant 1 message Nov 9, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

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

to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
v4l-vsp1-prevent-pipelines-from-running-when-not-streaming.patch
and it can be found in the queue-4.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From e4e70a147a48618a36ae1b81c641516cb9d45993 Mon Sep 17 00:00:00 2001

From: Laurent Pinchart <[email protected]>
Date: Fri, 8 Jul 2016 06:20:51 -0300
Subject: [media] v4l: vsp1: Prevent pipelines from running when not streaming

From: Laurent Pinchart <[email protected]>

commit e4e70a147a48618a36ae1b81c641516cb9d45993 upstream.

Pipelines can only be run if all their video nodes are streaming. Commit b4dfb9b35a19 ("[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 b4dfb9b35a19 ("[media] v4l: vsp1: Stop the pipeline upon the first STREAMOFF")
---
 drivers/media/platform/vsp1/vsp1_video.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/media/platform/vsp1/vsp1_video.c +7 -0
@@ -675,6 +675,13 @@ static void vsp1_video_stop_streaming(st
 	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. */

Patches currently in stable-queue which might be from [email protected] are

queue-4.8/v4l-vsp1-prevent-pipelines-from-running-when-not-streaming.patch