[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250708084654.15145-1-johan@kernel.org>
Date: Tue, 8 Jul 2025 10:46:54 +0200
From: Johan Hovold <johan@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Dave Ertman <david.m.ertman@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Leon Romanovsky <leon@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>,
Jerome Brunet <jbrunet@...libre.com>,
linux-kernel@...r.kernel.org,
Johan Hovold <johan@...nel.org>
Subject: [PATCH] driver core: auxiliary bus: fix OF node leak
Make sure to drop the OF node reference taken when creating an auxiliary
device using auxiliary_device_create() when the device is later
released.
Fixes: eaa0d30216c1 ("driver core: auxiliary bus: add device creation helpers")
Cc: Jerome Brunet <jbrunet@...libre.com>
Signed-off-by: Johan Hovold <johan@...nel.org>
---
drivers/base/auxiliary.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
index dba7c8e13a53..6bdefebf3609 100644
--- a/drivers/base/auxiliary.c
+++ b/drivers/base/auxiliary.c
@@ -399,6 +399,7 @@ static void auxiliary_device_release(struct device *dev)
{
struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
+ of_node_put(dev->of_node);
kfree(auxdev);
}
@@ -435,6 +436,7 @@ struct auxiliary_device *auxiliary_device_create(struct device *dev,
ret = auxiliary_device_init(auxdev);
if (ret) {
+ of_node_put(auxdev->dev.of_node);
kfree(auxdev);
return NULL;
}
--
2.49.0
Powered by blists - more mailing lists