aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2015-03-24 13:30:55 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-10 09:09:54 -0400
commit23b6ee5cd9d99d9d99d92ff923d6971a33dc7b03 (patch)
tree3f5ef5fac49922e3eea3ba3b0647995c72081c03
parent6ba53b81b6f8ad0fde3d7834ad7714abc12aacaa (diff)
[media] coda: fail to start streaming if userspace set invalid formats
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/platform/coda/coda-common.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 9b46088c8c7b..7dfc86efc055 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1282,12 +1282,23 @@ static int coda_start_streaming(struct vb2_queue *q, unsigned int count)
1282 if (!(ctx->streamon_out & ctx->streamon_cap)) 1282 if (!(ctx->streamon_out & ctx->streamon_cap))
1283 return 0; 1283 return 0;
1284 1284
1285 q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
1286 if ((q_data_src->width != q_data_dst->width &&
1287 round_up(q_data_src->width, 16) != q_data_dst->width) ||
1288 (q_data_src->height != q_data_dst->height &&
1289 round_up(q_data_src->height, 16) != q_data_dst->height)) {
1290 v4l2_err(v4l2_dev, "can't convert %dx%d to %dx%d\n",
1291 q_data_src->width, q_data_src->height,
1292 q_data_dst->width, q_data_dst->height);
1293 ret = -EINVAL;
1294 goto err;
1295 }
1296
1285 /* Allow BIT decoder device_run with no new buffers queued */ 1297 /* Allow BIT decoder device_run with no new buffers queued */
1286 if (ctx->inst_type == CODA_INST_DECODER && ctx->use_bit) 1298 if (ctx->inst_type == CODA_INST_DECODER && ctx->use_bit)
1287 v4l2_m2m_set_src_buffered(ctx->fh.m2m_ctx, true); 1299 v4l2_m2m_set_src_buffered(ctx->fh.m2m_ctx, true);
1288 1300
1289 ctx->gopcounter = ctx->params.gop_size - 1; 1301 ctx->gopcounter = ctx->params.gop_size - 1;
1290 q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
1291 1302
1292 ctx->codec = coda_find_codec(ctx->dev, q_data_src->fourcc, 1303 ctx->codec = coda_find_codec(ctx->dev, q_data_src->fourcc,
1293 q_data_dst->fourcc); 1304 q_data_dst->fourcc);