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 <[email protected]>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to