[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PAXPR04MB851054C5E1049B5361A46C108899A@PAXPR04MB8510.eurprd04.prod.outlook.com>
Date: Thu, 22 May 2025 13:57:20 +0000
From: Wei Fang <wei.fang@....com>
To: Andrew Lunn <andrew@...n.ch>
CC: "hkallweit1@...il.com" <hkallweit1@...il.com>, "linux@...linux.org.uk"
<linux@...linux.org.uk>, "davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>, "kuba@...nel.org"
<kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
"f.fainelli@...il.com" <f.fainelli@...il.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 net] net: phy: clear phydev->devlink when the link is
deleted
> On Thu, May 22, 2025 at 02:42:53PM +0800, Wei Fang wrote:
> > The phydev->devlink is not cleared when the link is deleted, so calling
> > phy_detach() again will cause a crash.
>
> I would say crashing is correct. You have done something you should
> not do, and the crash helped you find it. phy_attach() and
> phy_detach() should always be in pairs.
>
phy_attach() and phy_detach() are called in pairs in my case. When
re-enabling the network port, if an error occurs in the phy_attach_direct(),
For example, if phy_init_hw() returns an error, it will jump to the error
path and call phy_detach(). Because phy_detach() did not clear the
phydev->devlink pointer when the network port was disabled,
device_link_del() will access a NULL pointer and cause a crash. And this
crash may cause the CPU to hang. I don't think it is reasonable to cause
the CPU to hang.
Powered by blists - more mailing lists