* [PATCH] media: ti: vpe: fix double free after video device registration failure
@ 2026-11-03 17:40 Thomas Fourier
2026-11-21 13:32 ` Abhilash
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Fourier @ 2026-11-03 17:40 UTC (permalink / raw)
Cc: Thomas Fourier, Yemike Abhilash Chandra, Mauro Carvalho Chehab,
Kamil Debski, Archit Taneja, open list:TI VPE/CAL DRIVERS,
open list
vpe_fw_cb() is called asynchronously by vpe_probe().
If video_register_device() fails there, all the cleanup functions are
called. The driver stays bound, so vpe_remove() later does all of this
again, freeing dev->m2m_dev a second time.
Leave the cleanup to vpe_remove().
This bug was found statically and is theoretical.
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Fixes: b2c9472f0559 ("[media] v4l: ti-vpe: register video device only when firmware is loaded")
---
drivers/media/platform/ti/vpe/vpe.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/media/platform/ti/vpe/vpe.c b/drivers/media/platform/ti/vpe/vpe.c
index 81bd1f9cee30..761aa40a066e 100644
--- a/drivers/media/platform/ti/vpe/vpe.c
+++ b/drivers/media/platform/ti/vpe/vpe.c
@@ -2496,12 +2496,6 @@ static void vpe_fw_cb(struct platform_device *pdev)
if (ret) {
vpe_err(dev, "Failed to register video device\n");
- vpe_set_clock_enable(dev, 0);
- vpe_runtime_put(pdev);
- pm_runtime_disable(&pdev->dev);
- v4l2_m2m_release(dev->m2m_dev);
- v4l2_device_unregister(&dev->v4l2_dev);
-
return;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] media: ti: vpe: fix double free after video device registration failure
2026-11-03 17:40 [PATCH] media: ti: vpe: fix double free after video device registration failure Thomas Fourier
@ 2026-11-21 13:32 ` Abhilash
0 siblings, 0 replies; 2+ messages in thread
From: Abhilash @ 2026-11-21 13:32 UTC (permalink / raw)
To: Thomas Fourier
Cc: Mauro Carvalho Chehab, Kamil Debski, Archit Taneja,
open list:TI VPE/CAL DRIVERS, open list
Hi Thomas,
Thanks for the patch.
On Tue, 2026-11-03 at 18:40 +0100, Thomas Fourier wrote:
> vpe_fw_cb() is called asynchronously by vpe_probe().
> If video_register_device() fails there, all the cleanup functions are
> called. The driver stays bound, so vpe_remove() later does all of
> this
> again, freeing dev->m2m_dev a second time.
>
> Leave the cleanup to vpe_remove().
>
> This bug was found statically and is theoretical.
>
> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
> Fixes: b2c9472f0559 ("[media] v4l: ti-vpe: register video device only
> when firmware is loaded")
> ---
> drivers/media/platform/ti/vpe/vpe.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/media/platform/ti/vpe/vpe.c
> b/drivers/media/platform/ti/vpe/vpe.c
> index 81bd1f9cee30..761aa40a066e 100644
> --- a/drivers/media/platform/ti/vpe/vpe.c
> +++ b/drivers/media/platform/ti/vpe/vpe.c
> @@ -2496,12 +2496,6 @@ static void vpe_fw_cb(struct platform_device
> *pdev)
> if (ret) {
> vpe_err(dev, "Failed to register video device\n");
>
> - vpe_set_clock_enable(dev, 0);
> - vpe_runtime_put(pdev);
> - pm_runtime_disable(&pdev->dev);
> - v4l2_m2m_release(dev->m2m_dev);
> - v4l2_device_unregister(&dev->v4l2_dev);
> -
> return;
> }
>
I analysed the driver, and the fix seems correct. Hence,
Reviewed-by: Yemike Abhilash Chandra <y-abhilashchandra@ti.com>
Thanks and Regards,
Yemike Abhilash Chandra
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-21 13:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 17:40 [PATCH] media: ti: vpe: fix double free after video device registration failure Thomas Fourier
2026-11-21 13:32 ` Abhilash
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox