driver core: platform: fix fwnode leak on registration failure
Subsystems (2)
Johan Hovold
maintainerPATCH 1/1 driver core: platform: fix fwnode leak on registration failure
A recent change started taking a reference also to non-OF firmware nodes when registering platform devices.
The firmware node pointer is however still cleared on registration failure when ACPI support is enabled, which means that the reference leaks in platform_device_release() when the device is freed.
A software node also stays registered as device_remove_software_node() returns early.
Drop the clearing of the fwnode pointer when registration fails to fix the leak.
This issue was flagged by an LLM.
--- drivers/base/platform.c | 1 - 1 file changed, 1 deletion(-)
drivers/base/platform.c +0 -1
@@ -971,7 +971,6 @@ struct platform_device *platform_device_register_full(const struct platform_devi ret =platform_device_add (pdev);if (ret) { err: -ACPI_COMPANION_SET (&pdev->dev,NULL );platform_device_put (pdev);return ERR_PTR (ret); }
Signature · 1 line
2.55.0
Quoted 13 lines · Johan Hovold
A recent change started taking a reference also to non-OF firmware nodes when registering platform devices.
The firmware node pointer is however still cleared on registration failure when ACPI support is enabled, which means that the reference leaks in
platform_device_release()when the device is freed.A software node also stays registered as
device_remove_software_node()returns early.Drop the clearing of the fwnode pointer when registration fails to fix the leak.
Quoted 7 lines
This issue was flagged by an LLM.
Fixes 7b5b51b2b05c ("driver core: platform: count references to all kinds of firmware nodes")Cc [email protected] # 7.3Cc Bartosz Golaszewski <[email protected]>Signed-off-by Johan Hovold <[email protected]>---
Quoted 1 line · Johan Hovold
[PATCH] driver core: platform: fix fwnode leak on registration failure
Applied, thanks!
Branch: driver-core-testing
Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
[1/1] driver core: platform: fix fwnode leak on registration failure
commit: 7b4c25424cf5
The patch will appear in the next linux-next integration (typically within 24 hours on weekdays).
The patch is in the driver-core-testing branch and will be promoted to driver-core-next after validation.