From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PATCH 1/2] kvm: free resources after canceling async_pf Date: Wed, 4 Sep 2013 22:32:23 +0200 Message-ID: <1378326744-24434-2-git-send-email-rkrcmar@redhat.com> References: <1378326744-24434-1-git-send-email-rkrcmar@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, Gleb Natapov , Paolo Bonzini To: linux-kernel@vger.kernel.org Return-path: In-Reply-To: <1378326744-24434-1-git-send-email-rkrcmar@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org When we cancel 'async_pf_execute()', we should behave as if the work wa= s never scheduled in 'kvm_setup_async_pf()'. =46ixes a bug when we can't unload module because the vm wasn't destroy= ed. Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 --- virt/kvm/async_pf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c index b44cea0..f30aa1c 100644 --- a/virt/kvm/async_pf.c +++ b/virt/kvm/async_pf.c @@ -102,8 +102,11 @@ void kvm_clear_async_pf_completion_queue(struct kv= m_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); /* =3D=3D work->vcpu->kvm */ kmem_cache_free(async_pf_cache, work); + } } =20 spin_lock(&vcpu->async_pf.lock); --=20 1.8.3.1