Skip to content

Commit

Permalink
KVM: PPC: fix couple of memory leaks in MPIC/XICS devices
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gleb Natapov authored and Alexander Graf committed Jan 9, 2014
1 parent 398a76c commit 458ff3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/powerpc/kvm/book3s_xics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/kvm/mpic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 458ff3c

Please sign in to comment.