All of lore.kernel.org
 help / color / mirror / Atom feed
From: Abhilash <y-abhilashchandra@ti.com>
To: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Kamil Debski <k.debski@samsung.com>,
	Archit Taneja <archit@ti.com>,
	"open list:TI VPE/CAL DRIVERS" <linux-media@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] media: ti: vpe: fix double free after video device registration failure
Date: Sat, 21 Nov 2026 19:02:52 +0530	[thread overview]
Message-ID: <22e412eebcd3e4cef4dbef9d0daad8ee7dabffc2.camel@ti.com> (raw)
In-Reply-To: <20261103174036.62882-2-fourier.thomas@gmail.com>

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

      reply	other threads:[~2026-11-21 13:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22e412eebcd3e4cef4dbef9d0daad8ee7dabffc2.camel@ti.com \
    --to=y-abhilashchandra@ti.com \
    --cc=archit@ti.com \
    --cc=fourier.thomas@gmail.com \
    --cc=k.debski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.