From: Marc Zyngier <maz@kernel.org>
To: Wen Yang <wen.yang99@zte.com.cn>
Cc: <linux-kernel@vger.kernel.org>, <xue.zhihong@zte.com.cn>,
<wang.yi59@zte.com.cn>, <cheng.shengyu@zte.com.cn>,
Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Chris Brandt <chris.brandt@renesas.com>,
Simon Horman <horms+renesas@verge.net.au>
Subject: Re: [PATCH] irqchip: renesas-rza1: fix an use-after-free in rza1_irqc_probe()
Date: Fri, 26 Jul 2019 14:41:00 +0100 [thread overview]
Message-ID: <864l38oqvn.wl-maz@kernel.org> (raw)
In-Reply-To: <1562566745-7447-3-git-send-email-wen.yang99@zte.com.cn>
On Mon, 08 Jul 2019 07:19:04 +0100,
Wen Yang <wen.yang99@zte.com.cn> wrote:
>
> 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: a644ccb819bc ("irqchip: Add Renesas RZ/A1 Interrupt Controller driver")
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Chris Brandt <chris.brandt@renesas.com>
> Cc: Simon Horman <horms+renesas@verge.net.au>
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/irqchip/irq-renesas-rza1.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/irqchip/irq-renesas-rza1.c b/drivers/irqchip/irq-renesas-rza1.c
> index b1f19b21..b0d46ac 100644
> --- a/drivers/irqchip/irq-renesas-rza1.c
> +++ b/drivers/irqchip/irq-renesas-rza1.c
> @@ -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)
> --
> 2.9.5
>
Applied, thanks.
M.
--
Jazz is not dead, it just smells funny.
next prev parent reply other threads:[~2019-07-26 13:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-08 6:19 [PATCH] cpufreq/pasemi: fix an use-after-free in pas_cpufreq_cpu_init() Wen Yang
2019-07-08 6:19 ` [PATCH] crypto: crypto4xx: fix a potential double free in ppc4xx_trng_probe Wen Yang
2019-07-08 6:27 ` Julia Lawall
2019-07-09 12:14 ` Coccinelle: Checking the deletion of duplicate of_node_put() calls with SmPL Markus Elfring
2019-07-10 5:55 ` Markus Elfring
2019-07-12 10:17 ` [PATCH] crypto: crypto4xx: fix a potential double free in ppc4xx_trng_probe Herbert Xu
2019-07-08 6:19 ` [PATCH] irqchip: renesas-rza1: fix an use-after-free in rza1_irqc_probe() Wen Yang
2019-07-08 7:36 ` Geert Uytterhoeven
2019-07-09 12:58 ` [tip:irq/urgent] irqchip/renesas-rza1: Prevent " tip-bot for Wen Yang
2019-07-26 13:41 ` Marc Zyngier [this message]
2019-07-08 6:19 ` [PATCH] phy: ti: am654-serdes: fix an use-after-free in serdes_am654_clk_register() Wen Yang
2019-08-06 14:07 ` Roger Quadros
2019-07-08 6:27 ` [PATCH] cpufreq/pasemi: fix an use-after-free in pas_cpufreq_cpu_init() Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=864l38oqvn.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=cheng.shengyu@zte.com.cn \
--cc=chris.brandt@renesas.com \
--cc=geert+renesas@glider.be \
--cc=horms+renesas@verge.net.au \
--cc=jason@lakedaemon.net \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=wang.yi59@zte.com.cn \
--cc=wen.yang99@zte.com.cn \
--cc=xue.zhihong@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox