mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-04 05:29:15 +08:00
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: eaa0d30216 ("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f751fe2a2a
commit
6beb4ec0f9
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user