Re: [PATCH] media: ti: vpe: fix double free after video device registration failure
From: Abhilash
Date: Sat Nov 21 2026 - 08:34:27 EST
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@xxxxxxxxx>
> 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@xxxxxx>
Thanks and Regards,
Yemike Abhilash Chandra