]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc: fix unbalanced node refcount in check_kvm_guest()
authorNathan Lynch <nathanl@linux.ibm.com>
Tue, 28 Sep 2021 12:45:50 +0000 (07:45 -0500)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 8 Oct 2021 13:15:59 +0000 (00:15 +1100)
commitb5006e21f53b1da874d877868788978d7f8c2602
treea0f113789a60cfb1f3366add2ade67ce8327a59a
parent8a7a557beb87ba0f0d8906b5d044bffe7bcad0a5
powerpc: fix unbalanced node refcount in check_kvm_guest()

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: 4afab941cd5b ("powerpc/pseries: Add KVM guest doorbell restrictions")
Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210928124550.132020-1-nathanl@linux.ibm.com
arch/powerpc/kernel/firmware.c