OSDN Git Service

KVM: arm/arm64: vgic: Fix deadlock on error handling
authorMarc Zyngier <marc.zyngier@arm.com>
Thu, 12 Jan 2017 09:21:56 +0000 (09:21 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Jan 2017 07:24:39 +0000 (08:24 +0100)
commit26c4d513b6af730941bb4ff4c237789a4d190c27
tree499c1c93d3ddd682cd8bf72cf93776a0e7c6e5f4
parente0641f201114700dceac729babc89991ebb4b3ef
KVM: arm/arm64: vgic: Fix deadlock on error handling

commit 1193e6aeecb36c74c48c7cd0f641acbbed9ddeef upstream.

Dmitry Vyukov reported that the syzkaller fuzzer triggered a
deadlock in the vgic setup code when an error was detected, as
the cleanup code tries to take a lock that is already held by
the setup code.

The fix is to avoid retaking the lock when cleaning up, by
telling the cleanup function that we already hold it.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
virt/kvm/arm/vgic/vgic-init.c
virt/kvm/arm/vgic/vgic-v2.c
virt/kvm/arm/vgic/vgic-v3.c