2022-05-18 00:38:51

by Smitha T Murthy

[permalink] [raw]
Subject: [PATCH 17/20] 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.

Cc: [email protected]
Signed-off-by: Smitha T Murthy <[email protected]>
---
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 a70283d4c519..057088b9d327 100644
--- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c
@@ -469,8 +469,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



2022-05-18 03:51:38

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 17/20] media: s5p-mfc: Clear workbit to handle error condition

On 17/05/2022 14:55, Smitha T Murthy wrote:
> 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.
>
> Cc: [email protected]
> Signed-off-by: Smitha T Murthy <[email protected]>

This looks like a bugfix so:
1. Send it separately please.
2. Add Fixes tag.
3. Add Cc stable tag.

Best regards,
Krzysztof

2022-07-05 11:58:39

by Smitha T Murthy

[permalink] [raw]
Subject: RE: [PATCH 17/20] media: s5p-mfc: Clear workbit to handle error condition



> -----Original Message-----
> From: Krzysztof Kozlowski [mailto:[email protected]]
> Sent: Tuesday, May 17, 2022 7:34 PM
> To: Smitha T Murthy <[email protected]>; linux-arm-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]
> Cc: [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH 17/20] media: s5p-mfc: Clear workbit to handle error
> condition
>
> On 17/05/2022 14:55, Smitha T Murthy wrote:
> > 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.
> >
> > Cc: [email protected]
> > Signed-off-by: Smitha T Murthy <[email protected]>
>
> This looks like a bugfix so:
> 1. Send it separately please.
> 2. Add Fixes tag.
> 3. Add Cc stable tag.
>
> Best regards,
> Krzysztof

Ok I will send this separately

Regards,
Smitha