2023-10-27 09:19:00

by Zheng Wang

[permalink] [raw]
Subject: [PATCH 0/2] media: mtk-jpeg: Remove cancel worker in mtk_jpeg_remove to avoid the crash of multi-core JPEG devices

This patch reverts commit c677d7ae8314
("media: mtk-jpeg: Fix use after free bug due to uncanceled work").
The job_timeout_work is initialized only for
the single-core JPEG device so it will cause the crash for multi-core
JPEG devices.

Fix it by removing the cancel_delayed_work_sync function.

Fixes: c677d7ae8314 ("media: mtk-jpeg: Fix use after free bug due to uncanceled work")
Signed-off-by: Zheng Wang <[email protected]>
Signed-off-by: Dmitry Osipenko <[email protected]>
---
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
index 7194f88edc0f..60425c99a2b8 100644
--- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
@@ -1403,7 +1403,6 @@ static void mtk_jpeg_remove(struct platform_device *pdev)
{
struct mtk_jpeg_dev *jpeg = platform_get_drvdata(pdev);

- cancel_delayed_work_sync(&jpeg->job_timeout_work);
pm_runtime_disable(&pdev->dev);
video_unregister_device(jpeg->vdev);
v4l2_m2m_release(jpeg->m2m_dev);
--
2.25.1


2023-10-31 05:51:30

by Dmitry Osipenko

[permalink] [raw]
Subject: Re: [PATCH 0/2] media: mtk-jpeg: Remove cancel worker in mtk_jpeg_remove to avoid the crash of multi-core JPEG devices

On 10/27/23 12:16, Zheng Wang wrote:
> This patch reverts commit c677d7ae8314
> ("media: mtk-jpeg: Fix use after free bug due to uncanceled work").
> The job_timeout_work is initialized only for
> the single-core JPEG device so it will cause the crash for multi-core
> JPEG devices.
>
> Fix it by removing the cancel_delayed_work_sync function.
>
> Fixes: c677d7ae8314 ("media: mtk-jpeg: Fix use after free bug due to uncanceled work")
> Signed-off-by: Zheng Wang <[email protected]>
> Signed-off-by: Dmitry Osipenko <[email protected]>
> ---
> drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> index 7194f88edc0f..60425c99a2b8 100644
> --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> @@ -1403,7 +1403,6 @@ static void mtk_jpeg_remove(struct platform_device *pdev)
> {
> struct mtk_jpeg_dev *jpeg = platform_get_drvdata(pdev);
>
> - cancel_delayed_work_sync(&jpeg->job_timeout_work);
> pm_runtime_disable(&pdev->dev);
> video_unregister_device(jpeg->vdev);
> v4l2_m2m_release(jpeg->m2m_dev);

Please send all three patches as a single series and version it with v2.
Add cover letter with changelog.

# git format-patch --cover-letter -v2 -3

--
Best regards,
Dmitry

2023-10-31 06:13:46

by Zheng Hacker

[permalink] [raw]
Subject: Re: [PATCH 0/2] media: mtk-jpeg: Remove cancel worker in mtk_jpeg_remove to avoid the crash of multi-core JPEG devices

Dmitry Osipenko <[email protected]> 于2023年10月31日周二 13:49写道:
>
> On 10/27/23 12:16, Zheng Wang wrote:
> > This patch reverts commit c677d7ae8314
> > ("media: mtk-jpeg: Fix use after free bug due to uncanceled work").
> > The job_timeout_work is initialized only for
> > the single-core JPEG device so it will cause the crash for multi-core
> > JPEG devices.
> >
> > Fix it by removing the cancel_delayed_work_sync function.
> >
> > Fixes: c677d7ae8314 ("media: mtk-jpeg: Fix use after free bug due to uncanceled work")
> > Signed-off-by: Zheng Wang <[email protected]>
> > Signed-off-by: Dmitry Osipenko <[email protected]>
> > ---
> > drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> > index 7194f88edc0f..60425c99a2b8 100644
> > --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> > +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> > @@ -1403,7 +1403,6 @@ static void mtk_jpeg_remove(struct platform_device *pdev)
> > {
> > struct mtk_jpeg_dev *jpeg = platform_get_drvdata(pdev);
> >
> > - cancel_delayed_work_sync(&jpeg->job_timeout_work);
> > pm_runtime_disable(&pdev->dev);
> > video_unregister_device(jpeg->vdev);
> > v4l2_m2m_release(jpeg->m2m_dev);
>
> Please send all three patches as a single series and version it with v2.
> Add cover letter with changelog.
>
> # git format-patch --cover-letter -v2 -3
>

Thanks for your kind reminder. Will do right now.

Best regards,
Zheng Wang

> --
> Best regards,
> Dmitry
>