Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@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>

authored by

Johan Hovold and committed by
Greg Kroah-Hartman
6beb4ec0 f751fe2a

+2
+2
drivers/base/auxiliary.c
··· 399 399 { 400 400 struct auxiliary_device *auxdev = to_auxiliary_dev(dev); 401 401 402 + of_node_put(dev->of_node); 402 403 kfree(auxdev); 403 404 } 404 405 ··· 436 435 437 436 ret = auxiliary_device_init(auxdev); 438 437 if (ret) { 438 + of_node_put(auxdev->dev.of_node); 439 439 kfree(auxdev); 440 440 return NULL; 441 441 }