summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinyu Chen <b03824@freescale.com>2011-12-09 14:47:57 +0800
committerXinyu Chen <b03824@freescale.com>2011-12-09 14:47:57 +0800
commitfe6258e33abf3295c3f703195e4db3c0caa5eedd (patch)
tree349eacb6971b0012bf4d6f1483d792ab5bb4ade4
parentbb41d1842fd9ba9af646794ab9939149548fc82b (diff)
ENGR00169891 v4l2 capture: avoid streamon with only one buffer queued
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>
-rw-r--r--drivers/media/video/mxc/capture/mxc_v4l2_capture.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c
index 35fa5ada92ce..a2db5282e18a 100644
--- a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c
+++ b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c
@@ -380,6 +380,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;