aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorRadim Krčmář <rkrcmar@redhat.com>2013-09-04 16:32:23 -0400
committerGleb Natapov <gleb@redhat.com>2013-09-17 05:53:15 -0400
commit28b441e24088081c1e213139d1303b451a34a4f4 (patch)
treeb5f1b975ed8b5dafa126bd58092677cc273171a1 /virt
parent72f857950f6f19cba42a9ded078bbc99f10aa667 (diff)
kvm: free resources after canceling async_pf
When we cancel 'async_pf_execute()', we should behave as if the work was never scheduled in 'kvm_setup_async_pf()'. Fixes a bug when we can't unload module because the vm wasn't destroyed. Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/async_pf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c
index ea475cd03511..8a39dda7a325 100644
--- a/virt/kvm/async_pf.c
+++ b/virt/kvm/async_pf.c
@@ -101,8 +101,11 @@ void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu)
101 typeof(*work), queue); 101 typeof(*work), queue);
102 cancel_work_sync(&work->work); 102 cancel_work_sync(&work->work);
103 list_del(&work->queue); 103 list_del(&work->queue);
104 if (!work->done) /* work was canceled */ 104 if (!work->done) { /* work was canceled */
105 mmdrop(work->mm);
106 kvm_put_kvm(vcpu->kvm); /* == work->vcpu->kvm */
105 kmem_cache_free(async_pf_cache, work); 107 kmem_cache_free(async_pf_cache, work);
108 }
106 } 109 }
107 110
108 spin_lock(&vcpu->async_pf.lock); 111 spin_lock(&vcpu->async_pf.lock);