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: <20220714145956.pnq5yulgete4xc2g@skbuf>
Date:   Thu, 14 Jul 2022 17:59:56 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Liang He <windhl@....com>
Cc:     woojung.huh@...rochip.com, UNGLinuxDriver@...rochip.com,
        andrew@...n.ch, vivien.didelot@...il.com, f.fainelli@...il.com,
        netdev@...r.kernel.org
Subject: Re: [PATCH] net: dsa: microchip: ksz_common: Fix refcount leak bug

On Wed, Jul 13, 2022 at 07:54:28PM +0800, Liang He wrote:
> In ksz_switch_register(), we should call of_node_put() for the
> reference returned by of_get_child_by_name() which has increased
> the refcount.
> 
> Fixes: 44e53c88828f ("net: dsa: microchip: support for "ethernet-ports" node")

I disagree with the git blame resolution, it should be:

Fixes: 912aae27c6af ("net: dsa: microchip: really look for phy-mode in port nodes")

Please resend with that line changed.

> Signed-off-by: Liang He <windhl@....com>
> ---
>  
>  drivers/net/dsa/microchip/ksz_common.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
> index 9ca8c8d7740f..92a500e1ccd2 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -1038,18 +1038,21 @@ int ksz_switch_register(struct ksz_device *dev,
>  		ports = of_get_child_by_name(dev->dev->of_node, "ethernet-ports");
>  		if (!ports)
>  			ports = of_get_child_by_name(dev->dev->of_node, "ports");
> -		if (ports)
> +		if (ports) {
>  			for_each_available_child_of_node(ports, port) {
>  				if (of_property_read_u32(port, "reg",
>  							 &port_num))
>  					continue;
>  				if (!(dev->port_mask & BIT(port_num))) {
>  					of_node_put(port);
> +					of_node_put(ports);
>  					return -EINVAL;
>  				}
>  				of_get_phy_mode(port,
>  						&dev->ports[port_num].interface);
>  			}
> +			of_node_put(ports);
> +		}
>  		dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
>  							 "microchip,synclko-125");
>  		dev->synclko_disable = of_property_read_bool(dev->dev->of_node,
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ