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]
Date: Thu, 10 Aug 2023 20:21:02 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: Xiang Yang <xiangyang@...weicloud.com>
Cc: clement.leger@...tlin.com, andrew@...n.ch, hkallweit1@...il.com,
	linux@...linux.org.uk, davem@...emloft.net, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, f.fainelli@...il.com,
	linux-renesas-soc@...r.kernel.org, netdev@...r.kernel.org,
	xiangyang3@...wei.com,
	Alexis Lothoré <alexis.lothore@...tlin.com>
Subject: Re: [PATCH net v2] net: pcs: Add missing put_device call in
 miic_create

On Thu, Aug 10, 2023 at 10:06:39PM +0800, Xiang Yang wrote:
> From: Xiang Yang <xiangyang3@...wei.com>
> 
> The reference of pdev->dev is taken by of_find_device_by_node, so
> it should be released when not need anymore.
> 
> Fixes: 7dc54d3b8d91 ("net: pcs: add Renesas MII converter driver")
> Signed-off-by: Xiang Yang <xiangyang3@...wei.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@...il.com>

>  drivers/net/pcs/pcs-rzn1-miic.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
> index e5d642c67a2c..97139c07130f 100644
> --- a/drivers/net/pcs/pcs-rzn1-miic.c
> +++ b/drivers/net/pcs/pcs-rzn1-miic.c
> @@ -314,15 +314,21 @@ struct phylink_pcs *miic_create(struct device *dev, struct device_node *np)
>  
>  	pdev = of_find_device_by_node(pcs_np);
>  	of_node_put(pcs_np);
> -	if (!pdev || !platform_get_drvdata(pdev))
> +	if (!pdev || !platform_get_drvdata(pdev)) {
> +		if (pdev)
> +			put_device(&pdev->dev);
>  		return ERR_PTR(-EPROBE_DEFER);
> +	}
>  
>  	miic_port = kzalloc(sizeof(*miic_port), GFP_KERNEL);
> -	if (!miic_port)
> +	if (!miic_port) {
> +		put_device(&pdev->dev);
>  		return ERR_PTR(-ENOMEM);
> +	}
>  
>  	miic = platform_get_drvdata(pdev);
>  	device_link_add(dev, miic->dev, DL_FLAG_AUTOREMOVE_CONSUMER);
> +	put_device(&pdev->dev);
>  
>  	miic_port->miic = miic;
>  	miic_port->port = port - 1;
> -- 
> 2.34.1
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ