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] [day] [month] [year] [list]
Date:   Thu, 28 Apr 2022 09:52:07 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
        <grygorii.strashko@...com>, <davem@...emloft.net>
Subject: Re: [PATCH] net: cpsw: add missing of_node_put() in cpsw_probe_dt()

On Thu, 28 Apr 2022 09:45:14 +0800 Yang Yingliang wrote:
> If devm_kcalloc() fails, 'tmp_node' should be put in cpsw_probe_dt().
> 
> Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>

Why does the error path (the err_node_put label) 
not put the tmp_node reference either?

> diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c
> index bd4b1528cf99..b81179f7d738 100644
> --- a/drivers/net/ethernet/ti/cpsw_new.c
> +++ b/drivers/net/ethernet/ti/cpsw_new.c
> @@ -1246,8 +1246,10 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw)
>  	data->slave_data = devm_kcalloc(dev, CPSW_SLAVE_PORTS_NUM,
>  					sizeof(struct cpsw_slave_data),
>  					GFP_KERNEL);
> -	if (!data->slave_data)
> +	if (!data->slave_data) {
> +		of_node_put(tmp_node);
>  		return -ENOMEM;
> +	}
>  
>  	/* Populate all the child nodes here...
>  	 */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ