Skip to content

Commit

Permalink
xen: fix memory leak in Xen PCI MSI/MSI-X allocator.
Browse files Browse the repository at this point in the history
Stanse found that xen_setup_msi_irqs leaks memory when
xen_allocate_pirq fails. Free the memory in that fail path.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel@lists.xensource.com
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
  • Loading branch information
Jiri Slaby authored and Konrad Rzeszutek Wilk committed Nov 8, 2010
1 parent 1688c3d commit 07cf2a6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arch/x86/pci/xen.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
irq = xen_allocate_pirq(v[i], 0, /* not sharable */
(type == PCI_CAP_ID_MSIX) ?
"pcifront-msi-x" : "pcifront-msi");
if (irq < 0)
return -1;
if (irq < 0) {
ret = -1;
goto free;
}

ret = set_irq_msi(irq, msidesc);
if (ret)
Expand All @@ -164,7 +166,7 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
if (ret == -ENODEV)
dev_err(&dev->dev, "Xen PCI frontend has not registered" \
" MSI/MSI-X support!\n");

free:
kfree(v);
return ret;
}
Expand Down

0 comments on commit 07cf2a6

Please sign in to comment.