summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorEric Auger <eric.auger@redhat.com>2018-05-22 09:55:06 +0200
committerMarc Zyngier <marc.zyngier@arm.com>2018-05-25 12:29:26 +0100
commit9153ab724ea1f47840cab0cedb12683b37272067 (patch)
tree3176a1241438ad79a6e95f9d51f7e1ad0335dd57 /virt
parentcf412b0070221032c02c4564cd11dc83238b2ad2 (diff)
downloadlinux-9153ab724ea1f47840cab0cedb12683b37272067.tar.gz
linux-9153ab724ea1f47840cab0cedb12683b37272067.tar.bz2
linux-9153ab724ea1f47840cab0cedb12683b37272067.zip
KVM: arm/arm64: Set dist->spis to NULL after kfree
in case kvm_vgic_map_resources() fails, typically if the vgic distributor is not defined, __kvm_vgic_destroy will be called several times. Indeed kvm_vgic_map_resources() is called on first vcpu run. As a result dist->spis is freeed more than once and on the second time it causes a "kernel BUG at mm/slub.c:3912!" Set dist->spis to NULL to avoid the crash. Fixes: ad275b8bb1e6 ("KVM: arm/arm64: vgic-new: vgic_init: implement vgic_init") Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com> Reviewed-by: Christoffer Dall <christoffer.dall@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/vgic/vgic-init.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c
index e07156c30323..9a5aed7eecfd 100644
--- a/virt/kvm/arm/vgic/vgic-init.c
+++ b/virt/kvm/arm/vgic/vgic-init.c
@@ -308,6 +308,7 @@ static void kvm_vgic_dist_destroy(struct kvm *kvm)
dist->initialized = false;
kfree(dist->spis);
+ dist->spis = NULL;
dist->nr_spis = 0;
if (vgic_supports_direct_msis(kvm))