Patch "cpuidle: riscv-sbi: fix device node release in early exit of for_each_possible_cpu" has been added to the 6.1-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

    cpuidle: riscv-sbi: fix device node release in early exit of for_each_possible_cpu

to the 6.1-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:
     cpuidle-riscv-sbi-fix-device-node-release-in-early-e.patch
and it can be found in the queue-6.1 subdirectory.

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



commit a1cd665fe54127fcd4f57f07885640101144cf76
Author: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx>
Date:   Sat Nov 16 00:32:39 2024 +0100

    cpuidle: riscv-sbi: fix device node release in early exit of for_each_possible_cpu
    
    [ Upstream commit 7e25044b804581b9c029d5a28d8800aebde18043 ]
    
    The 'np' device_node is initialized via of_cpu_device_node_get(), which
    requires explicit calls to of_node_put() when it is no longer required
    to avoid leaking the resource.
    
    Instead of adding the missing calls to of_node_put() in all execution
    paths, use the cleanup attribute for 'np' by means of the __free()
    macro, which automatically calls of_node_put() when the variable goes
    out of scope. Given that 'np' is only used within the
    for_each_possible_cpu(), reduce its scope to release the nood after
    every iteration of the loop.
    
    Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver")
    Reviewed-by: Andrew Jones <ajones@xxxxxxxxxxxxxxxx>
    Signed-off-by: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20241116-cpuidle-riscv-sbi-cleanup-v3-1-a3a46372ce08@xxxxxxxxx
    Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c
index af7320a768d2..963d5f171ef7 100644
--- a/drivers/cpuidle/cpuidle-riscv-sbi.c
+++ b/drivers/cpuidle/cpuidle-riscv-sbi.c
@@ -540,12 +540,12 @@ static int sbi_cpuidle_probe(struct platform_device *pdev)
 	int cpu, ret;
 	struct cpuidle_driver *drv;
 	struct cpuidle_device *dev;
-	struct device_node *np, *pds_node;
+	struct device_node *pds_node;
 
 	/* Detect OSI support based on CPU DT nodes */
 	sbi_cpuidle_use_osi = true;
 	for_each_possible_cpu(cpu) {
-		np = of_cpu_device_node_get(cpu);
+		struct device_node *np __free(device_node) = of_cpu_device_node_get(cpu);
 		if (np &&
 		    of_find_property(np, "power-domains", NULL) &&
 		    of_find_property(np, "power-domain-names", NULL)) {




[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