KVM: arm/arm64: vgic-its: Check GITS_BASER Valid bit before saving tables
authorEric Auger <eric.auger@redhat.com>
Thu, 26 Oct 2017 15:23:06 +0000 (17:23 +0200)
committerChristoffer Dall <christoffer.dall@linaro.org>
Sun, 29 Oct 2017 02:25:06 +0000 (03:25 +0100)
commitc2385eaa6c5a87cdc4e04ed589ae103ca3297c84
tree712404cee49dc091b21b2923b531697197a940c8
parentc9b51bb60d944067f36f67750e19c18c3cc2697c
KVM: arm/arm64: vgic-its: Check GITS_BASER Valid bit before saving tables

At the moment we don't properly check the GITS_BASER<n>.Valid
bit before saving the collection and device tables.

On vgic_its_save_collection_table() we use the GITS_BASER gpa
field whereas the Valid bit should be used.

On vgic_its_save_device_tables() there is no check. This can
cause various bugs, among which a subsequent fault when accessing
the table in guest memory.

Let's systematically check the Valid bit before doing anything.

We also uniformize the code between save and restore.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
virt/kvm/arm/vgic/vgic-its.c