From: Arun Iyengar hantro_get_ref() returns a CAPTURE buffer by timestamp without checking its size. A buffer decoded before the CAPTURE format grew, or one whose job was refused for being too small, is then read as a reference at the new size, past its end. Treat such a buffer as a missing reference: the callers then use the current picture. Fixes: bbd267daf4fc ("media: verisilicon: vp9: Allow to change resolution while streaming") Cc: stable@vger.kernel.org Signed-off-by: Arun Iyengar --- drivers/media/platform/verisilicon/hantro_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c index 6e2a90dfc639..573818ecc9d8 100644 --- a/drivers/media/platform/verisilicon/hantro_drv.c +++ b/drivers/media/platform/verisilicon/hantro_drv.c @@ -66,7 +66,7 @@ dma_addr_t hantro_get_ref(struct hantro_ctx *ctx, u64 ts) struct vb2_buffer *buf; buf = vb2_find_buffer(q, ts); - if (!buf) + if (!buf || !hantro_dec_buf_fits(ctx, buf)) return 0; return hantro_get_dec_buf_addr(ctx, buf); } -- 2.55.0