diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2015-01-23 19:51:18 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-02-02 14:59:53 +0300 |
commit | 07ba277f896ec774cb529277d6072a5611b34f18 (patch) | |
tree | 56cb46e87674fbcfe9b858328b5f1be8651aa739 /drivers/media/platform/coda/coda-bit.c | |
parent | e1519e866b73ff49aaf017d8ac08eb96944ff191 (diff) | |
download | linux-07ba277f896ec774cb529277d6072a5611b34f18.tar.xz |
[media] coda: move meta out of padding
Handle an empty buffer metadata list without crashing. This can happen
if the decoder is fed a broken stream, or multiple compressed frames in
a single queued buffer.
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>
Diffstat (limited to 'drivers/media/platform/coda/coda-bit.c')
-rw-r--r-- | drivers/media/platform/coda/coda-bit.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index b4029ae293d3..f6cf337bf377 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c @@ -1565,6 +1565,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx) struct vb2_buffer *dst_buf; struct coda_dev *dev = ctx->dev; struct coda_q_data *q_data_dst; + struct coda_buffer_meta *meta; u32 reg_addr, reg_stride; dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); @@ -1643,12 +1644,12 @@ static int coda_prepare_decode(struct coda_ctx *ctx) coda_write(dev, ctx->iram_info.axi_sram_use, CODA7_REG_BIT_AXI_SRAM_USE); - if (ctx->codec->src_fourcc == V4L2_PIX_FMT_JPEG) { - struct coda_buffer_meta *meta; + meta = list_first_entry_or_null(&ctx->buffer_meta_list, + struct coda_buffer_meta, list); + + if (meta && ctx->codec->src_fourcc == V4L2_PIX_FMT_JPEG) { /* If this is the last buffer in the bitstream, add padding */ - meta = list_first_entry(&ctx->buffer_meta_list, - struct coda_buffer_meta, list); if (meta->end == (ctx->bitstream_fifo.kfifo.in & ctx->bitstream_fifo.kfifo.mask)) { static unsigned char buf[512]; |