]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: PPC: fix couple of memory leaks in MPIC/XICS devices
authorGleb Natapov <gleb@redhat.com>
Sun, 1 Sep 2013 12:53:46 +0000 (15:53 +0300)
committerAlexander Graf <agraf@suse.de>
Thu, 9 Jan 2014 09:14:54 +0000 (10:14 +0100)
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>
arch/powerpc/kvm/book3s_xics.c
arch/powerpc/kvm/mpic.c

index 02a17dcf16107adbe1309185bf464d0fda4b8772..d1acd32a64c034649447413fcde90b15826c86cd 100644 (file)
@@ -1246,8 +1246,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);
 
index 2861ae9eaae6e2f841af45bc928cec309303d66c..efbd9962a209c999ff9ab8ff4959d9e4522d296b 100644 (file)
@@ -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)