summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2025-07-08 10:46:54 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-08-15 16:38:34 +0200
commiteee98f05775ddd62fe1a04d318c4da82a5af0c95 (patch)
tree97084cbb295e73f928b4cf3037751ac610cdc80e
parent7608e9aa78a09641ac5cb100d8101e12c1b1e0ee (diff)
driver core: auxiliary bus: fix OF node leak
[ Upstream commit 6beb4ec0f9fdff4c4c6eb8ed8654fe8396c2b6e0 ] 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@baylibre.com> Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Danilo Krummrich <dakr@kernel.org> Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20250708084654.15145-1-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/base/auxiliary.c2
1 files changed, 2 insertions, 0 deletions
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;
}