lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 6 Jul 2023 09:43:02 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Lu Hongfei <luhongfei@...o.com>
Cc:     Shawn Guo <shawnguo@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        NXP Linux Team <linux-imx@....com>,
        Rob Herring <robh@...nel.org>, Mark Brown <broonie@...nel.org>,
        Saravana Kannan <saravanak@...gle.com>,
        Ivan Bornyakov <i.bornyakov@...rotek.ru>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Minghao Chi <chi.minghao@....com.cn>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        opensource.kernel@...o.com
Subject: Re: [PATCH] drivers: bus: Fix resource leaks in for_each_available_child_of_node
 loop

Hi Lu,

Thanks for your patch!

On Thu, Jul 6, 2023 at 9:13 AM Lu Hongfei <luhongfei@...o.com> wrote:
> Ensure child node references are decremented properly in
> the error path.

Which error path?

>
> Signed-off-by: Lu Hongfei <luhongfei@...o.com>
> ---
>  drivers/bus/imx-weim.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c
> index 52a5d0447390..d05472f7c20f 100644
> --- a/drivers/bus/imx-weim.c
> +++ b/drivers/bus/imx-weim.c
> @@ -251,6 +251,7 @@ static int weim_parse_dt(struct platform_device *pdev)
>                 else
>                         have_child = 1;
>         }
> +       of_node_put(child);

This is not an error path.

for_each_available_child_of_node() walks a list, getting a reference
to each child, and releasing the reference afterwards.

Have you tested this patch?
I expect the of_node_put() to trigger a refcount underflow error
message on the console.

>
>         if (have_child)
>                 ret = of_platform_default_populate(pdev->dev.of_node,

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ