aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/coalesced_mmio.c
diff options
context:
space:
mode:
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>2010-03-15 09:13:30 -0400
committerAvi Kivity <avi@redhat.com>2010-05-17 05:15:53 -0400
commit6ce5a090a9a0ea4266a2cad058c69e2f27201e11 (patch)
treeae8223dc3c73309fb34890b735bb4a0d75caafdc /virt/kvm/coalesced_mmio.c
parent31299944584fd62df8b0cfa30ad2c56f445b8cf2 (diff)
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 <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt/kvm/coalesced_mmio.c')
-rw-r--r--virt/kvm/coalesced_mmio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
index b66001f8754..53850177163 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)
120 return ret; 120 return ret;
121 121
122out_free_dev: 122out_free_dev:
123 kvm->coalesced_mmio_dev = NULL;
123 kfree(dev); 124 kfree(dev);
124out_free_page: 125out_free_page:
126 kvm->coalesced_mmio_ring = NULL;
125 __free_page(page); 127 __free_page(page);
126out_err: 128out_err:
127 return ret; 129 return ret;