Skip to content

Commit

Permalink
media: s5p-mfc: Clear workbit to handle error condition
Browse files Browse the repository at this point in the history
[ Upstream commit d3f3c2f ]

During error on CLOSE_INSTANCE command, ctx_work_bits was not getting
cleared. During consequent mfc execution NULL pointer dereferencing of
this context led to kernel panic. This patch fixes this issue by making
sure to clear ctx_work_bits always.

Fixes: 818cd91 ("[media] s5p-mfc: Extract open/close MFC instance commands")
Cc: stable@vger.kernel.org
Cc: linux-fsd@tesla.com
Signed-off-by: Smitha T Murthy <smitha.t@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
smithatmurthy authored and gregkh committed Jan 12, 2023
1 parent 4653ba3 commit ff27800
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
Expand Up @@ -468,8 +468,10 @@ void s5p_mfc_close_mfc_inst(struct s5p_mfc_dev *dev, struct s5p_mfc_ctx *ctx)
s5p_mfc_hw_call(dev->mfc_ops, try_run, dev);
/* Wait until instance is returned or timeout occurred */
if (s5p_mfc_wait_for_done_ctx(ctx,
S5P_MFC_R2H_CMD_CLOSE_INSTANCE_RET, 0))
S5P_MFC_R2H_CMD_CLOSE_INSTANCE_RET, 0)){
clear_work_bit_irqsave(ctx);
mfc_err("Err returning instance\n");
}

/* Free resources */
s5p_mfc_hw_call(dev->mfc_ops, release_codec_buffers, ctx);
Expand Down

0 comments on commit ff27800

Please sign in to comment.