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:
 <PAXPR04MB851003DFCAA705E17F7B7117886CA@PAXPR04MB8510.eurprd04.prod.outlook.com>
Date: Wed, 4 Jun 2025 12:08:26 +0000
From: Wei Fang <wei.fang@....com>
To: Russell King <linux@...linux.org.uk>
CC: "Abhishek Chauhan (ABC)" <quic_abchauha@...cinc.com>, Florian Fainelli
	<f.fainelli@...il.com>, "andrew@...n.ch" <andrew@...n.ch>,
	"hkallweit1@...il.com" <hkallweit1@...il.com>, "davem@...emloft.net"
	<davem@...emloft.net>, "edumazet@...gle.com" <edumazet@...gle.com>,
	"kuba@...nel.org" <kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
	"xiaolei.wang@...driver.com" <xiaolei.wang@...driver.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"imx@...ts.linux.dev" <imx@...ts.linux.dev>
Subject: RE: [PATCH v2 net] net: phy: clear phydev->devlink when the link is
 deleted

> On Wed, Jun 04, 2025 at 06:00:54AM +0000, Wei Fang wrote:
> > I think this issue is also introduced by the commit bc66fa87d4fd
> > ("net: phy: Add link between phy dev and mac dev"). I suggested
> > to change the DL_FLAG_STATELESS flag to
> > DL_FLAG_AUTOREMOVE_SUPPLIER to solve this issue, so that
> > the consumer (MAC controller) driver will be automatically removed
> > when the link is removed. The changes are as follows.
> 
> I suspect this still has problems. This is fine if the PHY device is
> going away and as you say device_del() is called.
> 
> However, you need to consider the case where a MAC driver attaches the
> PHY during .ndo_open and releases it during .ndo_release. These will
> happen multiple times.

.ndo_release? Do you mean .ndo_stop?

> 
> Each time the MAC driver attaches to the PHY via .ndo_open, we will
> call device_link_add(), but the device link will not be removed when
> .ndo_release is called.
> 
> Either device_link_add() will fail, or we will eat memory each time
> the device is closed and re-opened.

Below is what I find in the kernel doc of device_link_add().
https://elixir.bootlin.com/linux/v6.15/source/drivers/base/core.c#L711

if a device link between the given @consumer and @supplier pair
exists already when this function is called for them, the existing link will
be returned regardless of its current type and status.

Therefore, it will not create new link each time the netdev is re-opened.

> 
> If that is correct, then we're trading one problem for another.
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ