]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00169891 v4l2 capture: avoid streamon with only one buffer queued
authorXinyu Chen <b03824@freescale.com>
Fri, 9 Dec 2011 06:47:57 +0000 (14:47 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:33:35 +0000 (08:33 +0200)
If user space only queue one buffer into ready list, and
call streamon, camera csi enc ISR will crash.
Since for CSI ENC, the ping pong buffer is initilized without
checking ready buffer on streamon.
The second buffer will be wrongly in cam_data struct, and causes
DMA fill buffers into cam_data global variable.
Here just add one sanity check for ready buffer.

Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
drivers/media/video/mxc/capture/mxc_v4l2_capture.c

index a6045061f505ee72595262f3a92aa4ba9df3c54c..e4108c291c4061e7420469962c8185e42b4df3f2 100644 (file)
@@ -382,6 +382,12 @@ static int mxc_streamon(cam_data *cam)
                        "queued yet\n");
                return -EINVAL;
        }
+       if (cam->enc_update_eba &&
+               cam->ready_q.prev == cam->ready_q.next) {
+               pr_err("ERROR: v4l2 capture: mxc_streamon buffer need ping pong "
+                       "at least two buffers\n");
+               return -EINVAL;
+       }
 
        cam->capture_pid = current->pid;