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: <20220526182309.2412106d@dellmb>
Date:   Thu, 26 May 2022 18:23:09 +0200
From:   Marek BehĂșn <kabel@...nel.org>
To:     Miaoqian Lin <linmq006@...il.com>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] net: dsa: mv88e6xxx: Fix refcount leak in
 mv88e6xxx_mdios_register

On Thu, 26 May 2022 18:52:08 +0400
Miaoqian Lin <linmq006@...il.com> wrote:

> of_get_child_by_name() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when done.
> 
> mv88e6xxx_mdio_register() pass the device node to of_mdiobus_register().
> We don't need the device node after it.
> 
> Add missing of_node_put() to avoid refcount leak.
> 
> Fixes: a3c53be55c95 ("net: dsa: mv88e6xxx: Support multiple MDIO busses")
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
> changes in v2:
> - Add fixes tag.
> changes in v3:
> - Move of_node_put() statement to cover normal path.
> - Update commit message.
> 
> I do cross-check to determine we should release the node after
> of_mdiobus_register(), refer to functions like lan78xx_mdio_init(),
> ave_init() and ag71xx_mdio_probe().
> 
> v1 link: https://lore.kernel.org/r/20220526083748.39816-1-linmq006@gmail.com/
> v2 link: https://lore.kernel.org/all/20220526112415.13835-1-linmq006@gmail.com/
> ---
>  drivers/net/dsa/mv88e6xxx/chip.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index 5d2c57a7c708..0b49d243e00b 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -3960,6 +3960,7 @@ static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip,
>  	 */
>  	child = of_get_child_by_name(np, "mdio");
>  	err = mv88e6xxx_mdio_register(chip, child, false);
> +	of_node_put(child);
>  	if (err)
>  		return err;
>  

Reviewed-by: Marek BehĂșn <kabel@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ