From: Alexander Graf Date: Mon, 22 Feb 2010 15:52:14 +0000 (+0100) Subject: KVM: PPC: Destory timer on vcpu destruction X-Git-Tag: Ubuntu-5.10.0-12.13~28544^2~226 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=a595405df9efb89710cd555d29df0e4902f90613;p=mirror_ubuntu-hirsute-kernel.git KVM: PPC: Destory timer on vcpu destruction When we destory a vcpu, we should also make sure to kill all pending timers that could still be up. When not doing this, hrtimers might dereference null pointers trying to call our code. This patch fixes spontanious kernel panics seen after closing VMs. Signed-off-by: Alexander Graf Signed-off-by: Avi Kivity --- diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index ad2b6275acb7..ace31ca05245 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -200,6 +200,10 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) { + /* Make sure we're not using the vcpu anymore */ + hrtimer_cancel(&vcpu->arch.dec_timer); + tasklet_kill(&vcpu->arch.tasklet); + kvmppc_remove_vcpu_debugfs(vcpu); kvmppc_core_vcpu_free(vcpu); }