Patch "powerpc: fix unbalanced node refcount in check_kvm_guest()" has been added to the 5.10-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

    powerpc: fix unbalanced node refcount in check_kvm_guest()

to the 5.10-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:
     powerpc-fix-unbalanced-node-refcount-in-check_kvm_gu.patch
and it can be found in the queue-5.10 subdirectory.

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



commit d47984e0564f2979a5adedd79199472513ad0268
Author: Nathan Lynch <nathanl@xxxxxxxxxxxxx>
Date:   Tue Sep 28 07:45:50 2021 -0500

    powerpc: fix unbalanced node refcount in check_kvm_guest()
    
    [ Upstream commit 56537faf8821e361d739fc5ff58c9c40f54a1d4c ]
    
    When check_kvm_guest() succeeds in looking up a /hypervisor OF node, it
    returns without performing a matching put for the lookup, leaving the
    node's reference count elevated.
    
    Add the necessary call to of_node_put(), rearranging the code slightly to
    avoid repetition or goto.
    
    Fixes: 107c55005fbd ("powerpc/pseries: Add KVM guest doorbell restrictions")
    Signed-off-by: Nathan Lynch <nathanl@xxxxxxxxxxxxx>
    Reviewed-by: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx>
    Reviewed-by: Tyrel Datwyler <tyreld@xxxxxxxxxxxxx>
    Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210928124550.132020-1-nathanl@xxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/powerpc/kernel/firmware.c b/arch/powerpc/kernel/firmware.c
index c7022c41cc314..20328f72f9f2b 100644
--- a/arch/powerpc/kernel/firmware.c
+++ b/arch/powerpc/kernel/firmware.c
@@ -31,11 +31,10 @@ int __init check_kvm_guest(void)
 	if (!hyper_node)
 		return 0;
 
-	if (!of_device_is_compatible(hyper_node, "linux,kvm"))
-		return 0;
-
-	static_branch_enable(&kvm_guest);
+	if (of_device_is_compatible(hyper_node, "linux,kvm"))
+		static_branch_enable(&kvm_guest);
 
+	of_node_put(hyper_node);
 	return 0;
 }
 core_initcall(check_kvm_guest); // before kvm_guest_init()



[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