FAILED: patch "[PATCH] KVM: arm/arm64: vgic: Fix potential deadlock when ap_list is" failed to apply to 4.19-stable tree
[email protected]
maintainerThe patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d4a8061a7c5f7c27a2dc002ee4cb89b3e6637e44 Mon Sep 17 00:00:00 2001
From: Heyi Guo <[email protected]>
Date: Tue, 27 Aug 2019 12:26:50 +0100
Subject: [PATCH] KVM: arm/arm64: vgic: Fix potential deadlock when ap_list is
long
If the ap_list is longer than 256 entries, merge_final() in list_sort() will call the comparison callback with the same element twice, causing a deadlock in vgic_irq_cmp().
Fix it by returning early when irqa == irqb.
virt/kvm/arm/vgic/vgic.c +7 -0
@@ -254,6 +254,13 @@ static int vgic_irq_cmp(void *priv, struct list_head *a, struct list_head *b)bool penda, pendb;int ret; +/* +* list_sort may call this function with the same element when +* the list is fairly long. +*/ +if (unlikely (irqa == irqb)) +return 0 ; +raw_spin_lock (&irqa->irq_lock);raw_spin_lock_nested (&irqb->irq_lock,SINGLE_DEPTH_NESTING );
Sasha Levin
maintainerQuoted 5 lines · On Tue, Sep 03, 2019 at 08:40:37PM +0200, [email protected] wrote:
The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
I've fixed it up and queued it for 4.19, 4.14, and 4.9. Just context changes due to missing 8fa3adb8c6bee (KVM: arm/arm64: vgic: Make vgic_irq->irq_lock a raw_spinlock).
--
Thanks,
Sasha