From: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Thomas Fourier <fourier.thomas@gmail.com>,
Yemike Abhilash Chandra <y-abhilashchandra@ti.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Kamil Debski <k.debski@samsung.com>,
Archit Taneja <archit@ti.com>,
linux-media@vger.kernel.org (open list:TI VPE/CAL DRIVERS),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] media: ti: vpe: fix double free after video device registration failure
Date: Tue, 3 Nov 2026 18:40:34 +0100 [thread overview]
Message-ID: <20261103174036.62882-2-fourier.thomas@gmail.com> (raw)
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
reply other threads:[~2026-11-03 17:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261103174036.62882-2-fourier.thomas@gmail.com \
--to=fourier.thomas@gmail.com \
--cc=archit@ti.com \
--cc=k.debski@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=y-abhilashchandra@ti.com \
/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 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®