[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220811155632.1536867-37-sashal@kernel.org>
Date: Thu, 11 Aug 2022 11:55:46 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Justin Green <greenjustin@...omium.org>,
Andres Calderon Jaramillo <andrescj@...omium.org>,
Nicolas Dufresne <nicolas.dufresne@...labora.com>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Sasha Levin <sashal@...nel.org>, matthias.bgg@...il.com,
acourbot@...omium.org, tzungbi@...gle.com,
yunfei.dong@...iatek.com, hiroh@...omium.org,
linux-media@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: [PATCH AUTOSEL 5.15 37/69] media: mediatek: vcodec: return EINVAL if plane is too small
From: Justin Green <greenjustin@...omium.org>
[ Upstream commit f5caaa47f55fa742f1a230e5b4258c139e223c74 ]
Modify vb2ops_vdec_buf_prepare to return EINVAL if the size of the plane
is less than the size of the image. Currently we just log an error and
return 0 anyway, which may cause a buffer overrun bug.
Signed-off-by: Justin Green <greenjustin@...omium.org>
Suggested-by: Andres Calderon Jaramillo <andrescj@...omium.org>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@...labora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@...all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
index 56d86e59421e..71646ef31663 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
@@ -1120,6 +1120,7 @@ static int vb2ops_vdec_buf_prepare(struct vb2_buffer *vb)
mtk_v4l2_err("data will not fit into plane %d (%lu < %d)",
i, vb2_plane_size(vb, i),
q_data->sizeimage[i]);
+ return -EINVAL;
}
}
--
2.35.1
Powered by blists - more mailing lists