]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
KVM: arm/arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST read
authorEric Auger <eric.auger@redhat.com>
Mon, 12 Apr 2021 15:00:34 +0000 (17:00 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Thu, 15 Jul 2021 17:27:47 +0000 (19:27 +0200)
commitfbb270fbaf41ab4c91ae7193dfc6c72637f974bd
treec5492ca90e93f1d17a5a7e3c8be9e2cfd265fcb4
parent162fcd1486512bad9bce3751b32d632053c2271f
KVM: arm/arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST read

BugLink: https://bugs.launchpad.net/bugs/1934179
commit 94ac0835391efc1a30feda6fc908913ec012951e upstream.

When reading the base address of the a REDIST region
through KVM_VGIC_V3_ADDR_TYPE_REDIST we expect the
redistributor region list to be populated with a single
element.

However list_first_entry() expects the list to be non empty.
Instead we should use list_first_entry_or_null which effectively
returns NULL if the list is empty.

Fixes: dbd9733ab674 ("KVM: arm/arm64: Replace the single rdist region by a list")
Cc: <Stable@vger.kernel.org> # v4.18+
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reported-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210412150034.29185-1-eric.auger@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
virt/kvm/arm/vgic/vgic-kvm-device.c