lkml.org 
[lkml]   [2010]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] x86: pci/xen, fix memory leak
    Date
    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>
    Cc: 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
    ---
    arch/x86/pci/xen.c | 8 +++++---
    1 files changed, 5 insertions(+), 3 deletions(-)

    diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
    index 117f5b8..d7b5109 100644
    --- a/arch/x86/pci/xen.c
    +++ b/arch/x86/pci/xen.c
    @@ -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)
    @@ -164,7 +166,7 @@ error:
    if (ret == -ENODEV)
    dev_err(&dev->dev, "Xen PCI frontend has not registered" \
    " MSI/MSI-X support!\n");
    -
    +free:
    kfree(v);
    return ret;
    }
    --
    1.7.3.1



    \
     
     \ /
      Last update: 2010-11-06 10:09    [W:0.019 / U:63.216 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site