From 6ce5a090a9a0ea4266a2cad058c69e2f27201e11 Mon Sep 17 00:00:00 2001 From: Takuya Yoshikawa Date: Mon, 15 Mar 2010 22:13:30 +0900 Subject: KVM: coalesced_mmio: fix kvm_coalesced_mmio_init()'s error handling kvm_coalesced_mmio_init() keeps to hold the addresses of a coalesced mmio ring page and dev even after it has freed them. Also, if this function fails, though it might be rare, it seems to be suggesting the system's serious state: so we'd better stop the works following the kvm_creat_vm(). This patch clears these problems. We move the coalesced mmio's initialization out of kvm_create_vm(). This seems to be natural because it includes a registration which can be done only when vm is successfully created. Signed-off-by: Takuya Yoshikawa Signed-off-by: Marcelo Tosatti --- virt/kvm/coalesced_mmio.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'virt/kvm/coalesced_mmio.c') diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c index b66001f8754c..53850177163f 100644 --- a/virt/kvm/coalesced_mmio.c +++ b/virt/kvm/coalesced_mmio.c @@ -120,8 +120,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; -- cgit v1.2.3