summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda
diff options
context:
space:
mode:
authorPhilipp Zabel2017-12-07 15:59:50 +0100
committerMauro Carvalho Chehab2017-12-18 20:59:52 +0100
commit25141bc7ac6f4fa1fe54cec748d4d5458c370a7d (patch)
tree1dfa3e7be99345e02d09ab44a01d73e3348b0012 /drivers/media/platform/coda
parentmedia: coda: round up frame sizes to multiples of 16 for MPEG-4 decoder (diff)
downloadkernel-qcow2-linux-25141bc7ac6f4fa1fe54cec748d4d5458c370a7d.tar.gz
kernel-qcow2-linux-25141bc7ac6f4fa1fe54cec748d4d5458c370a7d.tar.xz
kernel-qcow2-linux-25141bc7ac6f4fa1fe54cec748d4d5458c370a7d.zip
media: coda: allocate space for mpeg4 decoder mvcol buffer
The MPEG-4 decoder mvcol buffer was registered, but its size not added to a frame buffer allocation. This could cause the decoder to write past the end of the allocated buffer for large frame sizes. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform/coda')
-rw-r--r--drivers/media/platform/coda/coda-bit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
index 87002bede5ea..32db1227d025 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -414,8 +414,10 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx,
size = round_up(ysize, 4096) + ysize / 2;
else
size = ysize + ysize / 2;
- if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 &&
- dev->devtype->product != CODA_DX6)
+ /* Add space for mvcol buffers */
+ if (dev->devtype->product != CODA_DX6 &&
+ (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 ||
+ (ctx->codec->src_fourcc == V4L2_PIX_FMT_MPEG4 && i == 0)))
size += ysize / 4;
name = kasprintf(GFP_KERNEL, "fb%d", i);
if (!name) {