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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201112124110.yhquvw2cptvh2oii@skbuf>
Date:   Thu, 12 Nov 2020 14:41:10 +0200
From:   Vladimir Oltean <olteanv@...il.com>
To:     Zhang Changzhong <zhangchangzhong@...wei.com>
Cc:     hauke@...ke-m.de, andrew@...n.ch, vivien.didelot@...il.com,
        f.fainelli@...il.com, davem@...emloft.net, kuba@...nel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: dsa: lantiq_gswip: add missed
 clk_disable_unprepare() in gswip_gphy_fw_load()

On Thu, Nov 12, 2020 at 07:11:35PM +0800, Zhang Changzhong wrote:
> Fix missing clk_disable_unprepare() before return from
> gswip_gphy_fw_load() in the error handling case.
> 
> Fixes: 14fceff4771e ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Zhang Changzhong <zhangchangzhong@...wei.com>
> ---
>  drivers/net/dsa/lantiq_gswip.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
> index 74db81d..8936d65 100644
> --- a/drivers/net/dsa/lantiq_gswip.c
> +++ b/drivers/net/dsa/lantiq_gswip.c
> @@ -1682,6 +1682,7 @@ static int gswip_gphy_fw_load(struct gswip_priv *priv, struct gswip_gphy_fw *gph
>  	if (ret) {
>  		dev_err(dev, "failed to load firmware: %s, error: %i\n",
>  			gphy_fw->fw_name, ret);
> +		clk_disable_unprepare(gphy_fw->clk_gate);
>  		return ret;
>  	}
>  
> @@ -1698,14 +1699,17 @@ static int gswip_gphy_fw_load(struct gswip_priv *priv, struct gswip_gphy_fw *gph
>  	} else {
>  		dev_err(dev, "failed to alloc firmware memory\n");
>  		release_firmware(fw);
> +		clk_disable_unprepare(gphy_fw->clk_gate);
>  		return -ENOMEM;
>  	}
>  
>  	release_firmware(fw);
>  
>  	ret = regmap_write(priv->rcu_regmap, gphy_fw->fw_addr_offset, dev_addr);
> -	if (ret)
> +	if (ret) {
> +		clk_disable_unprepare(gphy_fw->clk_gate);
>  		return ret;
> +	}
>  
>  	reset_control_deassert(gphy_fw->reset);
>  
> -- 
> 2.9.5
> 

gswip_gphy_fw_list
-> gswip_gphy_fw_probe
   -> gswip_gphy_fw_load
      -> clk_prepare_enable
      -> then fails

Then gswip_gphy_fw_list does this:
	for_each_available_child_of_node(gphy_fw_list_np, gphy_fw_np) {
		err = gswip_gphy_fw_probe(priv, &priv->gphy_fw[i],
					  gphy_fw_np, i);
		if (err)
			goto remove_gphy;
		i++;
	}

	return 0;

remove_gphy:
	for (i = 0; i < priv->num_gphy_fw; i++)
		gswip_gphy_fw_remove(priv, &priv->gphy_fw[i]);


Then gswip_gphy_fw_remove does this:
gswip_gphy_fw_remove
-> clk_disable_unprepare

What's wrong with this?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ