Patch "leds: led-core: Fix refcount leak in of_led_get()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    leds: led-core: Fix refcount leak in of_led_get()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     leds-led-core-fix-refcount-leak-in-of_led_get.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e0c25878491fe207e6aca5b9122bdd3f3b7d5406
Author: Miaoqian Lin <linmq006@xxxxxxxxx>
Date:   Tue Dec 20 16:18:07 2022 +0400

    leds: led-core: Fix refcount leak in of_led_get()
    
    [ Upstream commit da1afe8e6099980fe1e2fd7436dca284af9d3f29 ]
    
    class_find_device_by_of_node() calls class_find_device(), it will take
    the reference, use the put_device() to drop the reference when not need
    anymore.
    
    Fixes: 699a8c7c4bd3 ("leds: Add of_led_get() and led_put()")
    Signed-off-by: Miaoqian Lin <linmq006@xxxxxxxxx>
    Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221220121807.1543790-1-linmq006@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 6e88df4c87fa8..1024b1562aafc 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -235,6 +235,7 @@ 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);
 
 	if (!led_dev)
 		return ERR_PTR(-EPROBE_DEFER);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux