Message ID | 20240625-led-class-device-leak-v2-1-75fdccf47421@bootlin.com |
---|---|
State | New |
Headers | show |
Series | [v2] Revert "leds: led-core: Fix refcount leak in of_led_get()" | expand |
On Tue, 25 Jun 2024 10:34:38 +0200, Luca Ceresoli wrote: > This reverts commit da1afe8e6099980fe1e2fd7436dca284af9d3f29. > > Commit 699a8c7c4bd3 ("leds: Add of_led_get() and led_put()"), introduced in > 5.5, added of_led_get() and led_put() but missed a put_device() in > led_put(), thus creating a leak in case the consumer device is removed. > > Arguably device removal was not very popular, so this went apparently > unnoticed until 2022. In January 2023 two different patches got merged to > fix the same bug: > > [...] Applied, thanks! [1/1] Revert "leds: led-core: Fix refcount leak in of_led_get()" commit: 940b27161afc6ec53fc66245a4fb3518394cdc92 -- Lee Jones [李琼斯]
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 24fcff682b24..b23d2138cd83 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -258,7 +258,6 @@ struct led_classdev *of_led_get(struct device_node *np, int index) led_dev = class_find_device_by_of_node(&leds_class, led_node); of_node_put(led_node); - put_device(led_dev); return led_module_get(led_dev); }