Commit b5fa9fc9 authored by Wen Yang's avatar Wen Yang Committed by Marc Zyngier

irqchip/renesas-rza1: Fix an use-after-free in rza1_irqc_probe()

The gic_node is still being used in the rza1_irqc_parse_map() call
after the of_node_put() call, which may result in use-after-free.

Fixes: a644ccb8 ("irqchip: Add Renesas RZ/A1 Interrupt Controller driver")
Signed-off-by: default avatarWen Yang <wen.yang99@zte.com.cn>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent 9a446ef0
......@@ -208,20 +208,19 @@ static int rza1_irqc_probe(struct platform_device *pdev)
return PTR_ERR(priv->base);
gic_node = of_irq_find_parent(np);
if (gic_node) {
if (gic_node)
parent = irq_find_host(gic_node);
of_node_put(gic_node);
}
if (!parent) {
dev_err(dev, "cannot find parent domain\n");
return -ENODEV;
ret = -ENODEV;
goto out_put_node;
}
ret = rza1_irqc_parse_map(priv, gic_node);
if (ret) {
dev_err(dev, "cannot parse %s: %d\n", "interrupt-map", ret);
return ret;
goto out_put_node;
}
priv->chip.name = "rza1-irqc",
......@@ -237,10 +236,12 @@ static int rza1_irqc_probe(struct platform_device *pdev)
priv);
if (!priv->irq_domain) {
dev_err(dev, "cannot initialize irq domain\n");
return -ENOMEM;
ret = -ENOMEM;
}
return 0;
out_put_node:
of_node_put(gic_node);
return ret;
}
static int rza1_irqc_remove(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment