[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220907103227.61088-2-smitha.t@samsung.com>
Date: Wed, 7 Sep 2022 16:02:26 +0530
From: Smitha T Murthy <smitha.t@...sung.com>
To: linux-arm-kernel@...ts.infradead.org, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: m.szyprowski@...sung.com, andrzej.hajda@...el.com,
mchehab@...nel.org, alim.akhtar@...sung.com,
aswani.reddy@...sung.com, pankaj.dubey@...sung.com,
linux-fsd@...la.com, aakarsh.jain@...sung.com,
Smitha T Murthy <smitha.t@...sung.com>,
stable@...r.kernel.org
Subject: [PATCH 2/3] media: s5p-mfc: Clear workbit to handle error condition
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: 818cd91ab8c6e ("[media] s5p-mfc: Extract open/close MFC instance commands)
Cc: stable@...r.kernel.org
Cc: linux-fsd@...la.com
Signed-off-by: Smitha T Murthy <smitha.t@...sung.com>
---
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c
index 72d70984e99a..6d3c92045c05 100644
--- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c
@@ -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);
--
2.17.1
Powered by blists - more mailing lists