Commit 6c9934c5 authored by Sergey Senozhatsky's avatar Sergey Senozhatsky Committed by Hans Verkuil
Browse files

media: venus: fix enc/dec destruction order



We destroy mutex-es too early as they are still taken in
v4l2_fh_exit()->v4l2_event_unsubscribe()->v4l2_ctrl_find().

We should destroy mutex-es right before kfree().  Also
do not vdec_ctrl_deinit() before v4l2_fh_exit().

Fixes: 7472c1c6 ("[media] media: venus: vdec: add video decoder files")
Suggested-by: default avatarTomasz Figa <tfiga@google.com>
Signed-off-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarStanimir Varbanov <stanimir.k.varbanov@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
parent 0e1d123e
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1750,13 +1750,14 @@ static int vdec_close(struct file *file)
	cancel_work_sync(&inst->delayed_process_work);
	v4l2_m2m_ctx_release(inst->m2m_ctx);
	v4l2_m2m_release(inst->m2m_dev);
	vdec_ctrl_deinit(inst);
	ida_destroy(&inst->dpb_ids);
	hfi_session_destroy(inst);
	mutex_destroy(&inst->lock);
	mutex_destroy(&inst->ctx_q_lock);
	v4l2_fh_del(&inst->fh);
	v4l2_fh_exit(&inst->fh);
	vdec_ctrl_deinit(inst);

	mutex_destroy(&inst->lock);
	mutex_destroy(&inst->ctx_q_lock);

	vdec_pm_put(inst, false);

+3 −3
Original line number Diff line number Diff line
@@ -1542,14 +1542,14 @@ static int venc_close(struct file *file)

	v4l2_m2m_ctx_release(inst->m2m_ctx);
	v4l2_m2m_release(inst->m2m_dev);
	venc_ctrl_deinit(inst);
	hfi_session_destroy(inst);
	mutex_destroy(&inst->lock);
	mutex_destroy(&inst->ctx_q_lock);
	v4l2_fh_del(&inst->fh);
	v4l2_fh_exit(&inst->fh);
	venc_ctrl_deinit(inst);

	inst->enc_state = VENUS_ENC_STATE_DEINIT;
	mutex_destroy(&inst->lock);
	mutex_destroy(&inst->ctx_q_lock);

	venc_pm_put(inst, false);