[media] v4l: vsp1: Stop the pipeline upon the first STREAMOFF
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Sat, 18 Jun 2016 00:03:29 +0000 (21:03 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 28 Jun 2016 15:04:18 +0000 (12:04 -0300)
The device is stopped when STREAMOFF is called on the last video node in
the pipeline. This results in possible memory corruption and/or crashes,
as userspace could free buffers while the hardware is still writing to
them, and the frame completion interrupt handler could try to access
buffers that don't exist anymore.

Fix this by stopping the pipeline upon the first STREAMOFF call, not the
last.

Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/vsp1/vsp1_video.c

index a899b15c8d87262b432b00c287d9be4fb9bf8724..f6208b9d811846198868676a3eedc1056626e188 100644 (file)
@@ -674,7 +674,7 @@ static void vsp1_video_stop_streaming(struct vb2_queue *vq)
        int ret;
 
        mutex_lock(&pipe->lock);
-       if (--pipe->stream_count == 0) {
+       if (--pipe->stream_count == pipe->num_inputs) {
                /* Stop the pipeline. */
                ret = vsp1_pipeline_stop(pipe);
                if (ret == -ETIMEDOUT)
This page took 0.040953 seconds and 5 git commands to generate.