All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: fix couple of memory leaks in MPIC/XICS devices
@ 2013-09-01 12:53 ` Gleb Natapov
  0 siblings, 0 replies; 8+ messages in thread
From: Gleb Natapov @ 2013-09-01 12:53 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Paul Mackerras, kvm, kvm-ppc, Benjamin Herrenschmidt

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>
---
 Be warned that this is not even compiled tested.

diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
index 94c1dd4..97adfe8 100644
--- a/arch/powerpc/kvm/book3s_xics.c
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -1244,8 +1244,10 @@ static int kvmppc_xics_create(struct kvm_device *dev, u32 type)
 		kvm->arch.xics = xics;
 	mutex_unlock(&kvm->lock);
 
-	if (ret)
+	if (ret) {
+		kfree(xics);
 		return ret;
+	}
 
 	xics_debugfs_init(xics);
 
diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c
index 2861ae9..efbd996 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)
 
 	dev->kvm->arch.mpic = NULL;
 	kfree(opp);
+	kfree(dev);
 }
 
 static int mpic_set_default_irq_routing(struct openpic *opp)
--
			Gleb.

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

end of thread, other threads:[~2013-12-09 15:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-01 12:53 [PATCH] KVM: PPC: fix couple of memory leaks in MPIC/XICS devices Gleb Natapov
2013-09-01 12:53 ` Gleb Natapov
2013-09-04 10:49 ` Alexander Graf
2013-09-04 10:49   ` Alexander Graf
2013-09-04 12:16 ` Paul Mackerras
2013-09-04 12:16   ` Paul Mackerras
2013-12-09 15:16   ` Alexander Graf
2013-12-09 15:16     ` Alexander Graf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.