Skip to content

Commit

Permalink
kvm: free resources after canceling async_pf
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rkrcmar authored and Gleb Natapov committed Sep 17, 2013
1 parent 72f8579 commit 28b441e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion virt/kvm/async_pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 28b441e

Please sign in to comment.