mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] devcoredump: fix double free on device registration failure
@ 2026-11-02  8:25 Johan Hovold
  2026-11-09 22:13 ` Danilo Krummrich
  0 siblings, 1 reply; 2+ messages 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	[flat|nested] 2+ messages in thread

* Re: [PATCH] devcoredump: fix double free on device registration failure
  2026-11-02  8:25 [PATCH] devcoredump: fix double free on device registration failure Johan Hovold
@ 2026-11-09 22:13 ` Danilo Krummrich
  0 siblings, 0 replies; 2+ messages in thread
From: Danilo Krummrich @ 2026-11-09 22:13 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Johannes Berg, Greg Kroah-Hartman, Rafael J . Wysocki,
	Danilo Krummrich, driver-core, linux-kernel, stable,
	Johannes Berg

On Mon,  2 Nov 2026 09:25:36 +0100, Johan Hovold wrote:
> [PATCH] devcoredump: fix double free on device registration failure

Applied, thanks!

  Branch: driver-core-testing
  Tree:   git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git

[1/1] devcoredump: fix double free on device registration failure
      commit: de7625abe4e9

The patch will appear in the next linux-next integration (typically within 24
hours on weekdays).

The patch is in the driver-core-testing branch and will be promoted to
driver-core-next after validation.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-09 22:13 UTC | newest]

Thread overview: 2+ messages (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
2026-11-09 22:13 ` Danilo Krummrich

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®