]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm/arm64: vgic: Fix potential deadlock when ap_list is long
authorHeyi Guo <guoheyi@huawei.com>
Tue, 27 Aug 2019 11:26:50 +0000 (12:26 +0100)
committerWill Deacon <will@kernel.org>
Tue, 27 Aug 2019 15:19:56 +0000 (16:19 +0100)
commitfe8ba2c6cdab1d5734344c35930baecc51d52a19
tree4445c51f62bbf92da124109b3700a8020fd6dab2
parentf5d74be9518e938dd0b24345b0025e33e6303aac
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.

Cc: stable@vger.kernel.org # 4.7+
Fixes: d30527f354ec ("KVM: arm/arm64: vgic-new: Add IRQ sorting")
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Heyi Guo <guoheyi@huawei.com>
[maz: massaged commit log and patch, added Fixes and Cc-stable]
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
virt/kvm/arm/vgic/vgic.c