* [PATCH] devcoredump: fix double free on device registration failure
@ 2026-11-02 8:25 Johan Hovold
0 siblings, 0 replies; only message in thread
From: Johan Hovold @ 2026-11-02 8:25 UTC (permalink / raw)
To: Johannes Berg, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich, Johan Hovold
Cc: driver-core, linux-kernel, stable, Johannes Berg
The device coredump class release function devcd_dev_release() puts the
module reference and frees the data so just return after dropping the
device reference on registration failures to avoid a module reference
imbalance and double free.
This issue was flagged by an LLM.
Fixes: 833c95456a70 ("device coredump: add new device coredump class")
Cc: stable@vger.kernel.org # 3.18
Cc: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/base/devcoredump.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c
index 8bb1763083dd..16e99ac926a7 100644
--- a/drivers/base/devcoredump.c
+++ b/drivers/base/devcoredump.c
@@ -433,10 +433,12 @@ void dev_coredumpm_timeout(struct device *dev, struct module *owner,
devcd->init_completed = true;
mutex_unlock(&devcd->mutex);
return;
+
put_device:
mutex_unlock(&devcd->mutex);
cancel_delayed_work_sync(&devcd->del_wk);
put_device(&devcd->devcd_dev);
+ return;
put_module:
module_put(owner);
--
2.55.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-02 8:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-02 8:25 [PATCH] devcoredump: fix double free on device registration failure Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox