mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
KVM: arm/arm64: vgic: Fix potential double free dist->spis in __kvm_vgic_destroy()
[ Upstream commit 0bda9498dd45280e334bfe88b815ebf519602cc3 ] In kvm_vgic_dist_init() called from kvm_vgic_map_resources(), if dist->vgic_model is invalid, dist->spis will be freed without set dist->spis = NULL. And in vgicv2 resources clean up path, __kvm_vgic_destroy() will be called to free allocated resources. And dist->spis will be freed again in clean up chain because we forget to set dist->spis = NULL in kvm_vgic_dist_init() failed path. So double free would happen. Signed-off-by: Miaohe Lin <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Eric Auger <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
c306458a2b
commit
566b1bb7d3
1 changed files with 1 additions and 0 deletions
|
|
@ -177,6 +177,7 @@ static int kvm_vgic_dist_init(struct kvm *kvm, unsigned int nr_spis)
|
|||
break;
|
||||
default:
|
||||
kfree(dist->spis);
|
||||
dist->spis = NULL;
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue