Commit b7ccb9fb authored by Wu-Cheng Li's avatar Wu-Cheng Li Committed by Mauro Carvalho Chehab

[media] mtk-vcodec: add index check in decoder vidioc_qbuf

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: default avatarWu-Cheng Li <wuchengli@chromium.org>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 93d39efd
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment