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: <e4ab1950-a209-1748-7bee-c24d862800c5@seco.com>
Date:   Mon, 30 Jan 2023 14:43:50 -0500
From:   Sean Anderson <sean.anderson@...o.com>
To:     Vladimir Oltean <vladimir.oltean@....com>, netdev@...r.kernel.org
Cc:     Madalin Bucur <madalin.bucur@....com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Camelia Groza <camelia.groza@....com>,
        Maxime Chevallier <maxime.chevallier@...tlin.com>
Subject: Re: [PATCH net] net: fman: memac: free mdio device if
 lynx_pcs_create() fails

On 1/30/23 14:30, Vladimir Oltean wrote:
> When memory allocation fails in lynx_pcs_create() and it returns NULL,
> there remains a dangling reference to the mdiodev returned by
> of_mdio_find_device() which is leaked as soon as memac_pcs_create()
> returns empty-handed.
> 
> Fixes: a7c2a32e7f22 ("net: fman: memac: Use lynx pcs driver")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
> ---
>  drivers/net/ethernet/freescale/fman/fman_memac.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c
> index 9349f841bd06..587ad81a2dc3 100644
> --- a/drivers/net/ethernet/freescale/fman/fman_memac.c
> +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c
> @@ -1055,6 +1055,9 @@ static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node,
>  		return ERR_PTR(-EPROBE_DEFER);
>  
>  	pcs = lynx_pcs_create(mdiodev);
> +	if (!pcs)
> +		mdio_device_free(mdiodev);
> +
>  	return pcs;
>  }
>  

Reviewed-by: Sean Anderson <sean.anderson@...o.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ