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]
Message-ID: <6s1952p2-7rs5-06nn-19on-5170q4720852@syhkavp.arg>
Date: Fri, 4 Oct 2024 17:17:13 -0400 (EDT)
From: Nicolas Pitre <nico@...xnic.net>
To: Roger Quadros <rogerq@...nel.org>
cc: "David S. Miller" <davem@...emloft.net>, 
    Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, 
    Paolo Abeni <pabeni@...hat.com>, 
    Grygorii Strashko <grygorii.strashko@...com>, 
    Vignesh Raghavendra <vigneshr@...com>, netdev@...r.kernel.org, 
    linux-kernel@...r.kernel.org
Subject: Re: [PATCH net v3 2/2] net: ethernet: ti: am65-cpsw: avoid
 devm_alloc_etherdev, fix module removal

On Fri, 4 Oct 2024, Roger Quadros wrote:

> 
> 
> On 04/10/2024 18:37, Nicolas Pitre wrote:
> >>> diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> >>> index f6bc8a4dc6..e95457c988 100644
> >>> --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> >>> +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> >>> @@ -2744,10 +2744,9 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
> >>>  		return 0;
> >>>  
> >>>  	/* alloc netdev */
> >>> -	port->ndev = devm_alloc_etherdev_mqs(common->dev,
> >>> -					     sizeof(struct am65_cpsw_ndev_priv),
> >>> -					     AM65_CPSW_MAX_QUEUES,
> >>> -					     AM65_CPSW_MAX_QUEUES);
> >>> +	port->ndev = alloc_etherdev_mqs(sizeof(struct am65_cpsw_ndev_priv),
> >>> +					AM65_CPSW_MAX_QUEUES,
> >>> +					AM65_CPSW_MAX_QUEUES);
> >>
> >> Can we solve this issue without doing this change as
> >> there are many error cases relying on devm managed freeing of netdev.
> > 
> > If you know of a way to do this differently I'm all ears.
> 
> I sent another approach already. please check.

Slowly being built.

> > About the many error cases needing the freeing of net devices, as far as 
> > I know they're all covered with this patch.
> 
> No they are not. you now have to explicitly call free_netdev() in error paths of am65_cpsw_nuss_init_port_ndev().

And it does. If am65_cpsw_nuss_init_ndevs() fails then it frees them 
all. Same as with am65_cpsw_nuss_phylink_cleanup().


Nicolas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ