public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: coalesced_mmio: NULLify the pointers before freeing ring page and dev
@ 2010-03-12  3:05 Takuya Yoshikawa
  2010-03-12  3:41 ` Wei Yongjun
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Takuya Yoshikawa @ 2010-03-12  3:05 UTC (permalink / raw)
  To: avi, mtosatti; +Cc: kvm

kvm_coalesced_mmio_init() keeps to hold the addresses of a coalesced mmio
ring page and dev even after it has freed them.

This may trigger problems, e.g., if we call kvm_coalesced_mmio_free() in
kvm_destroy_vm() or kvm_vm_ioctl_register_coalesced_mmio() afterward.

This patch avoids such problems by NULLifying the pointers.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
---
 virt/kvm/coalesced_mmio.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
index 5169736..11776b7 100644
--- a/virt/kvm/coalesced_mmio.c
+++ b/virt/kvm/coalesced_mmio.c
@@ -119,8 +119,10 @@ int kvm_coalesced_mmio_init(struct kvm *kvm)
 	return ret;
 
 out_free_dev:
+	kvm->coalesced_mmio_dev = NULL;
 	kfree(dev);
 out_free_page:
+	kvm->coalesced_mmio_ring = NULL;
 	__free_page(page);
 out_err:
 	return ret;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-03-12 10:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12  3:05 [PATCH] KVM: coalesced_mmio: NULLify the pointers before freeing ring page and dev Takuya Yoshikawa
2010-03-12  3:41 ` Wei Yongjun
2010-03-12  4:15   ` Takuya Yoshikawa
2010-03-12  3:43 ` [PATCH] KVM: fix to not use NULL kvm->coalesced_mmio_ring in kvm_vcpu_fault() Wei Yongjun
2010-03-12  4:22   ` Takuya Yoshikawa
2010-03-12  7:52 ` [PATCH -v2] KVM: fix kvm_coalesced_mmio_init()'s error handling Takuya Yoshikawa
2010-03-12  7:56   ` Wei Yongjun
2010-03-12  8:00     ` Takuya Yoshikawa
2010-03-12  9:57 ` [PATCH -v3 1/2] KVM: introduce kvm_uninit_mmu_notifier() Takuya Yoshikawa
2010-03-12 10:12   ` Takuya Yoshikawa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox