v4l: CB0 NULL pointer panic in dmabuff_recycle_worker. [1/1]
PD#SWPL-197253
Problem:
Output dma buffers are recycled after vb2_buff_done causing the NULL
pointer panic.
Solution:
Make sure the works in es_wrk_in and ws_wrk_out are finish before
vb2_buff_done.
Verify:
sc2
Change-Id: Icf0fe4239142ca0c2af74cca12f8b6d9e1087764
Signed-off-by: yu.xie <yu.xie@amlogic.com>
diff --git a/drivers/amvdec_ports/aml_vcodec_dec.c b/drivers/amvdec_ports/aml_vcodec_dec.c
index 7bf2b4a..dfb3790 100644
--- a/drivers/amvdec_ports/aml_vcodec_dec.c
+++ b/drivers/amvdec_ports/aml_vcodec_dec.c
@@ -2499,6 +2499,10 @@
}
} else {
ctx->index_disp = 0;
+
+ spin_lock_irqsave(&ctx->es_wkr_slock, flags);
+ ctx->es_wkr_stop = true;
+ spin_unlock_irqrestore(&ctx->es_wkr_slock, flags);
}
v4l_dbg(ctx, V4L_DEBUG_CODEC_PROT,
@@ -5114,7 +5118,9 @@
}
if (V4L2_TYPE_IS_OUTPUT(q->type)) {
- struct vb2_queue * que = v4l2_m2m_get_dst_vq(ctx->m2m_ctx);;
+ struct vb2_queue * que = v4l2_m2m_get_dst_vq(ctx->m2m_ctx);
+
+ flush_work(&ctx->es_wkr_out);
INIT_KFIFO(ctx->dmabuff_recycle);
@@ -5212,14 +5218,8 @@
static void m2mops_vdec_job_abort(void *priv)
{
struct aml_vcodec_ctx *ctx = priv;
- ulong flags;
-
- spin_lock_irqsave(&ctx->es_wkr_slock, flags);
- ctx->es_wkr_stop = true;
- spin_unlock_irqrestore(&ctx->es_wkr_slock, flags);
flush_work(&ctx->es_wkr_in);
- flush_work(&ctx->es_wkr_out);
//v4l2_m2m_job_finish(ctx->dev->m2m_dev_dec, ctx->m2m_ctx);
v4l_dbg(ctx, V4L_DEBUG_CODEC_EXINFO, "%s\n", __func__);