aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2013-09-01 08:53:46 -0400
committerAlexander Graf <agraf@suse.de>2014-01-09 04:14:54 -0500
commit458ff3c099a1266991208f2c009afc2405e5b6bc (patch)
treef8fa168d2d33e3a0ed42b3a3a4644257364fc55d /arch/powerpc
parent398a76c677a2612c1b03a8d20fbf116e3778ebec (diff)
KVM: PPC: fix couple of memory leaks in MPIC/XICS devices
XICS failed to free xics structure on error path. MPIC destroy handler forgot to delete kvm_device structure. Signed-off-by: Gleb Natapov <gleb@redhat.com> Acked-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kvm/book3s_xics.c4
-rw-r--r--arch/powerpc/kvm/mpic.c1
2 files changed, 4 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
index 02a17dcf1610..d1acd32a64c0 100644
--- a/arch/powerpc/kvm/book3s_xics.c
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -1246,8 +1246,10 @@ static int kvmppc_xics_create(struct kvm_device *dev, u32 type)
1246 kvm->arch.xics = xics; 1246 kvm->arch.xics = xics;
1247 mutex_unlock(&kvm->lock); 1247 mutex_unlock(&kvm->lock);
1248 1248
1249 if (ret) 1249 if (ret) {
1250 kfree(xics);
1250 return ret; 1251 return ret;
1252 }
1251 1253
1252 xics_debugfs_init(xics); 1254 xics_debugfs_init(xics);
1253 1255
diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c
index 2861ae9eaae6..efbd9962a209 100644
--- a/arch/powerpc/kvm/mpic.c
+++ b/arch/powerpc/kvm/mpic.c
@@ -1635,6 +1635,7 @@ static void mpic_destroy(struct kvm_device *dev)
1635 1635
1636 dev->kvm->arch.mpic = NULL; 1636 dev->kvm->arch.mpic = NULL;
1637 kfree(opp); 1637 kfree(opp);
1638 kfree(dev);
1638} 1639}
1639 1640
1640static int mpic_set_default_irq_routing(struct openpic *opp) 1641static int mpic_set_default_irq_routing(struct openpic *opp)