linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] mtk-vcodec: add index check in decoder vidioc_qbuf
@ 2016-11-10  5:24 Wu-Cheng Li
  2016-11-10  5:24 ` Wu-Cheng Li
  0 siblings, 1 reply; 2+ messages in thread
From: Wu-Cheng Li @ 2016-11-10  5:24 UTC (permalink / raw)
  To: linux-arm-kernel

From: Wu-Cheng Li <wuchengli@google.com>

This patch adds a buffer index check in decoder vidioc_qbuf.

Wu-Cheng Li (1):
  mtk-vcodec: add index check in decoder vidioc_qbuf.

 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v1] mtk-vcodec: add index check in decoder vidioc_qbuf.
  2016-11-10  5:24 [PATCH v1] mtk-vcodec: add index check in decoder vidioc_qbuf Wu-Cheng Li
@ 2016-11-10  5:24 ` Wu-Cheng Li
  0 siblings, 0 replies; 2+ messages in thread
From: Wu-Cheng Li @ 2016-11-10  5:24 UTC (permalink / raw)
  To: linux-arm-kernel

From: Wu-Cheng Li <wuchengli@google.com>

vb2_qbuf will check the buffer index. If a driver overrides
vidioc_qbuf and use the buffer index, the driver needs to check
the index.

Signed-off-by: Wu-Cheng Li <wuchengli@chromium.org>
---
 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
index 0520919..0746592 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
@@ -533,6 +533,10 @@ static int vidioc_vdec_qbuf(struct file *file, void *priv,
 	}
 
 	vq = v4l2_m2m_get_vq(ctx->m2m_ctx, buf->type);
+	if (buf->index >= vq->num_buffers) {
+		mtk_v4l2_debug(1, "buffer index %d out of range", buf->index);
+		return -EINVAL;
+	}
 	vb = vq->bufs[buf->index];
 	vb2_v4l2 = container_of(vb, struct vb2_v4l2_buffer, vb2_buf);
 	mtkbuf = container_of(vb2_v4l2, struct mtk_video_dec_buf, vb);
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-10  5:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-10  5:24 [PATCH v1] mtk-vcodec: add index check in decoder vidioc_qbuf Wu-Cheng Li
2016-11-10  5:24 ` Wu-Cheng Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).