Skip to content

Commit

Permalink
media: mediatek: vcodec: Fix getting NULL pointer for dst buffer
Browse files Browse the repository at this point in the history
[ Upstream commit d879f77 ]

The driver may can't get v4l2 buffer when lat or core decode timeout,
will lead to crash when call v4l2_m2m_buf_done to set dst buffer
(NULL pointer) done.

Fixes: 7b182b8 ("media: mediatek: vcodec: Refactor get and put capture buffer flow")
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
yunfei-mtk authored and gregkh committed Dec 31, 2022
1 parent c9411d5 commit fd97525
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,13 @@ static void mtk_vdec_stateless_cap_to_disp(struct mtk_vcodec_ctx *ctx, int error
state = VB2_BUF_STATE_DONE;

vb2_dst = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx);
v4l2_m2m_buf_done(vb2_dst, state);

mtk_v4l2_debug(2, "free frame buffer id:%d to done list",
vb2_dst->vb2_buf.index);
if (vb2_dst) {
v4l2_m2m_buf_done(vb2_dst, state);
mtk_v4l2_debug(2, "free frame buffer id:%d to done list",
vb2_dst->vb2_buf.index);
} else {
mtk_v4l2_err("dst buffer is NULL");
}

if (src_buf_req)
v4l2_ctrl_request_complete(src_buf_req, &ctx->ctrl_hdl);
Expand Down

0 comments on commit fd97525

Please sign in to comment.