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]
Message-ID: <CAFnkrsmmn0ut2_9uJN3kS4uQGHuO0DONJveXvYm5oRMjKCoiZw@mail.gmail.com>
Date:   Wed, 18 May 2022 12:57:12 +0800
From:   呂芳騰 <wellslutw@...il.com>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     linux-kernel@...r.kernel.org, netdev <netdev@...r.kernel.org>,
        andrew@...n.ch, pabeni@...hat.com,
        David Miller <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH -next v2] net: ethernet: sunplus: add missing
 of_node_put() in spl2sw_mdio_init()

Hi Yingliang,

Thanks a lot for fixing the bug.

Reviewed-by: Wells Lu <wellslutw@...il.com>

Best regards,
Wells

Yang Yingliang <yangyingliang@...wei.com> 於 2022年5月18日 週三 上午9:56寫道:
>
> of_get_child_by_name() returns device node pointer with refcount
> incremented. The refcount should be decremented before returning
> from spl2sw_mdio_init().
>
> Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
> v2:
>   add fix tag.
> ---
>  drivers/net/ethernet/sunplus/spl2sw_mdio.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/sunplus/spl2sw_mdio.c b/drivers/net/ethernet/sunplus/spl2sw_mdio.c
> index 139ac8f2685e..733ae1704269 100644
> --- a/drivers/net/ethernet/sunplus/spl2sw_mdio.c
> +++ b/drivers/net/ethernet/sunplus/spl2sw_mdio.c
> @@ -97,8 +97,10 @@ u32 spl2sw_mdio_init(struct spl2sw_common *comm)
>
>         /* Allocate and register mdio bus. */
>         mii_bus = devm_mdiobus_alloc(&comm->pdev->dev);
> -       if (!mii_bus)
> -               return -ENOMEM;
> +       if (!mii_bus) {
> +               ret = -ENOMEM;
> +               goto out;
> +       }
>
>         mii_bus->name = "sunplus_mii_bus";
>         mii_bus->parent = &comm->pdev->dev;
> @@ -110,10 +112,13 @@ u32 spl2sw_mdio_init(struct spl2sw_common *comm)
>         ret = of_mdiobus_register(mii_bus, mdio_np);
>         if (ret) {
>                 dev_err(&comm->pdev->dev, "Failed to register mdiobus!\n");
> -               return ret;
> +               goto out;
>         }
>
>         comm->mii_bus = mii_bus;
> +
> +out:
> +       of_node_put(mdio_np);
>         return ret;
>  }
>
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ