public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* Patch "KVM: arm/arm64: Fix spinlock acquisition in vgic_set_owner" has been added to the 4.14-stable tree
@ 2018-02-23 11:10 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2018-02-23 11:10 UTC (permalink / raw)
  To: marc.zyngier, alexander.levin, christoffer.dall, gregkh,
	james.morse
  Cc: stable, stable-commits


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

    KVM: arm/arm64: Fix spinlock acquisition in vgic_set_owner

to the 4.14-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:
     kvm-arm-arm64-fix-spinlock-acquisition-in-vgic_set_owner.patch
and it can be found in the queue-4.14 subdirectory.

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


>From foo@baz Fri Feb 23 11:45:09 CET 2018
From: Marc Zyngier <marc.zyngier@arm.com>
Date: Thu, 30 Nov 2017 17:00:30 +0000
Subject: KVM: arm/arm64: Fix spinlock acquisition in vgic_set_owner

From: Marc Zyngier <marc.zyngier@arm.com>


[ Upstream commit 7465894e90e5a47e0e52aa5f1f708653fc40020f ]

vgic_set_owner acquires the irq lock without disabling interrupts,
resulting in a lockdep splat (an interrupt could fire and result
in the same lock being taken if the same virtual irq is to be
injected).

In practice, it is almost impossible to trigger this bug, but
better safe than sorry. Convert the lock acquisition to a
spin_lock_irqsave() and keep lockdep happy.

Reported-by: James Morse <james.morse@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 virt/kvm/arm/vgic/vgic.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -454,6 +454,7 @@ int kvm_vgic_unmap_phys_irq(struct kvm_v
 int kvm_vgic_set_owner(struct kvm_vcpu *vcpu, unsigned int intid, void *owner)
 {
 	struct vgic_irq *irq;
+	unsigned long flags;
 	int ret = 0;
 
 	if (!vgic_initialized(vcpu->kvm))
@@ -464,12 +465,12 @@ int kvm_vgic_set_owner(struct kvm_vcpu *
 		return -EINVAL;
 
 	irq = vgic_get_irq(vcpu->kvm, vcpu, intid);
-	spin_lock(&irq->irq_lock);
+	spin_lock_irqsave(&irq->irq_lock, flags);
 	if (irq->owner && irq->owner != owner)
 		ret = -EEXIST;
 	else
 		irq->owner = owner;
-	spin_unlock(&irq->irq_lock);
+	spin_unlock_irqrestore(&irq->irq_lock, flags);
 
 	return ret;
 }


Patches currently in stable-queue which might be from marc.zyngier@arm.com are

queue-4.14/arm-dts-fix-omap4-hang-with-gps-connected-to-usb-by-using-wakeupgen.patch
queue-4.14/kvm-arm-don-t-treat-unavailable-hyp-mode-as-an-error.patch
queue-4.14/kvm-arm-arm64-fix-spinlock-acquisition-in-vgic_set_owner.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-02-23 11:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-23 11:10 Patch "KVM: arm/arm64: Fix spinlock acquisition in vgic_set_owner" has been added to the 4.14-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox