lkml.org 
[lkml]   [2020]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v5 14/14] irqchip/xilinx-intc: Fix potential resource leak
    Date
    In the function xilinx_intc_of_init(), system resource "irqc->root_domain"
    was not released in an error case. Thus add a jump target to call the
    function "irq_domain_remove" for the completion of the desired exception
    handling.

    Fixes: 9689c99e4950 ("irqchip/xilinx: Add support for parent intc")
    Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
    ---
    drivers/irqchip/irq-xilinx-intc.c | 11 ++++++-----
    1 file changed, 6 insertions(+), 5 deletions(-)

    diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c
    index 1d3d273..41d9412 100644
    --- a/drivers/irqchip/irq-xilinx-intc.c
    +++ b/drivers/irqchip/irq-xilinx-intc.c
    @@ -192,7 +192,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
    ret = of_property_read_u32(intc, "xlnx,num-intr-inputs", &irqc->nr_irq);
    if (ret < 0) {
    pr_err("irq-xilinx: unable to read xlnx,num-intr-inputs\n");
    - goto error;
    + goto err_iounmap;
    }

    ret = of_property_read_u32(intc, "xlnx,kind-of-intr", &irqc->intr_mask);
    @@ -229,7 +229,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
    if (!irqc->root_domain) {
    pr_err("irq-xilinx: Unable to create IRQ domain\n");
    ret = -EINVAL;
    - goto error;
    + goto err_iounmap;
    }

    if (parent) {
    @@ -241,7 +241,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
    } else {
    pr_err("irq-xilinx: interrupts property not in DT\n");
    ret = -EINVAL;
    - goto error;
    + goto err_domain_remove;
    }
    } else {
    primary_intc = irqc;
    @@ -250,11 +250,12 @@ static int __init xilinx_intc_of_init(struct device_node *intc,

    return 0;

    -error:
    +err_domain_remove:
    + irq_domain_remove(irqc->root_domain);
    +err_iounmap:
    iounmap(irqc->base);
    kfree(irqc);
    return ret;
    -
    }

    IRQCHIP_DECLARE(xilinx_intc_xps, "xlnx,xps-intc-1.00.a", xilinx_intc_of_init);
    --
    2.1.0
    \
     
     \ /
      Last update: 2020-07-06 03:29    [W:3.001 / U:0.124 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site