Skip to contentSkip to conversation

leds: aw2013: fix leak of device node iterator

PATCH Superseded Tobias Jordan 2 participants 3 messages Sep 25, 2020 – Sep 30, 2020 LED

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 leds: aw2013: fix leak of device node iterator

In the error path of the for_each_available_child_of_node loop in aw2013_probe_dt, add missing call to of_node_put to avoid leaking the iterator.

Fixes 59ea3c9faf32 ("leds: add aw2013 driver")
---
 drivers/leds/leds-aw2013.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/leds/leds-aw2013.c +3 -1
index d709cc1f949e..8687ffa57a28 100644
@@ -305,8 +305,10 @@ static int aw2013_probe_dt(struct aw2013 *chip)
 
 		ret = devm_led_classdev_register_ext(&chip->client->dev,
 						     &led->cdev, &init_data);
-		if (ret < 0)
+		if (ret < 0) {
+			of_node_put(child);
 			return ret;
+		}
 
 		i++;
 	}
Signature · 1 line
2.20.1
#1 lore raw

Hi!

Quoted 6 lines

In the error path of the for_each_available_child_of_node loop in aw2013_probe_dt, add missing call to of_node_put to avoid leaking the iterator.

Fixes 59ea3c9faf32 ("leds: add aw2013 driver")

This failed to apply to my -for-next tree.

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#2 lore raw

On 2020-09-30 19:10, Pavel Machek wrote:
Hi Pavel,

Quoted 8 lines
Quoted 6 lines

In the error path of the for_each_available_child_of_node loop in aw2013_probe_dt, add missing call to of_node_put to avoid leaking the iterator.

Fixes 59ea3c9faf32 ("leds: add aw2013 driver")

This failed to apply to my -for-next tree.

Yes, it turns out this had been fixed by Marek already one day before I submitted my patch (in commit 2c6775625434) and I didn't notice that. So nothing to do there, sorry for the inconvenience.

Best regards,

Tobias