]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: vgic-v3: Fix vcpu index comparison
authorMarc Zyngier <maz@kernel.org>
Thu, 16 Dec 2021 10:45:26 +0000 (10:45 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 16 Dec 2021 10:47:24 +0000 (10:47 +0000)
commitc78fd048faeb701de3a564fabebcfa7f15babcc8
tree070cf237a7e24a5ee703011bf34d69baf5dc52d9
parentff04131966d1a79c1b3cf26997a8e7d1433f1b7d
KVM: arm64: vgic-v3: Fix vcpu index comparison

When handling an error at the point where we try and register
all the redistributors, we unregister all the previously
registered frames by counting down from the failing index.

However, the way the code is written relies on that index
being a signed value. Which won't be true once we switch to
an xarray-based vcpu set.

Since this code is pretty awkward the first place, and that the
failure mode is hard to spot, rewrite this loop to iterate
over the vcpus upwards rather than downwards.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211216104526.1482124-1-maz@kernel.org
arch/arm64/kvm/vgic/vgic-mmio-v3.c