mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: ti: vpe: fix double free after video device registration failure
@ 2026-11-03 17:40 Thomas Fourier
  0 siblings, 0 replies; only message 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	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-03 17:41 UTC | newest]

Thread overview: (only message) (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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®