]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
driver core: auxiliary bus: fix OF node leak
authorJohan Hovold <johan@kernel.org>
Tue, 8 Jul 2025 08:46:54 +0000 (10:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jul 2025 11:40:39 +0000 (13:40 +0200)
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>
drivers/base/auxiliary.c

index dba7c8e13a531fdf4070e476fbc9671a8bb886eb..6bdefebf36091c3a9c0bd4dc5c0dd514928d904f 100644 (file)
@@ -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;
        }