summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2016-06-17 21:03:29 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-06-28 12:04:18 -0300
commitb4dfb9b35a192f555d76fc4f670a447657bcc183 (patch)
tree432a3b27489ff1c9983c23bd1fb24a22f05df75c
parenteb9163d3bd2700ea3c6570a07e7548f678211dac (diff)
downloadlinux-stable-b4dfb9b35a192f555d76fc4f670a447657bcc183.tar.gz
linux-stable-b4dfb9b35a192f555d76fc4f670a447657bcc183.tar.bz2
linux-stable-b4dfb9b35a192f555d76fc4f670a447657bcc183.zip
[media] v4l: vsp1: Stop the pipeline upon the first STREAMOFF
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>
-rw-r--r--drivers/media/platform/vsp1/vsp1_video.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
index a899b15c8d87..f6208b9d8118 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -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)