diff options
author | Radim Krčmář <rkrcmar@redhat.com> | 2013-09-04 22:32:23 +0200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2014-06-09 13:29:03 +0100 |
commit | 21820c185fa08509ed2abaf4de43b56656eb038d (patch) | |
tree | f6e7b030dce655b3c7a6866cc7826753acd30dd8 /virt | |
parent | 6d7f02a611ae1a917db301e700b55e3af554d877 (diff) | |
download | lwn-21820c185fa08509ed2abaf4de43b56656eb038d.tar.gz lwn-21820c185fa08509ed2abaf4de43b56656eb038d.zip |
kvm: free resources after canceling async_pf
commit 28b441e24088081c1e213139d1303b451a34a4f4 upstream.
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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/async_pf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c index 74268b4c2ee1..1758e32863cf 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) typeof(*work), queue); cancel_work_sync(&work->work); list_del(&work->queue); - if (!work->done) /* work was canceled */ + if (!work->done) { /* work was canceled */ + mmdrop(work->mm); + kvm_put_kvm(vcpu->kvm); /* == work->vcpu->kvm */ kmem_cache_free(async_pf_cache, work); + } } spin_lock(&vcpu->async_pf.lock); |