提交 9153ab72 编写于 作者: E Eric Auger 提交者: Marc Zyngier

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: ad275b8b ("KVM: arm/arm64: vgic-new: vgic_init: implement
vgic_init")
Signed-off-by: NEric Auger <eric.auger@redhat.com>
Reviewed-by: NMarc Zyngier <marc.zyngier@arm.com>
Reviewed-by: NChristoffer Dall <christoffer.dall@arm.com>
Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
上级 cf412b00
...@@ -308,6 +308,7 @@ static void kvm_vgic_dist_destroy(struct kvm *kvm) ...@@ -308,6 +308,7 @@ static void kvm_vgic_dist_destroy(struct kvm *kvm)
dist->initialized = false; dist->initialized = false;
kfree(dist->spis); kfree(dist->spis);
dist->spis = NULL;
dist->nr_spis = 0; dist->nr_spis = 0;
if (vgic_supports_direct_msis(kvm)) if (vgic_supports_direct_msis(kvm))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册