mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 11:06:41 -05:00
net: ftgmac100: fix potential NULL pointer access in ftgmac100_phy_disconnect
After the call to phy_disconnect() netdev->phydev is reset to NULL.
So fixed_phy_unregister() would be called with a NULL pointer as argument.
Therefore cache the phy_device before this call.
Fixes: e24a6c8746 ("net: ftgmac100: Get link speed and duplex for NC-SI")
Cc: stable@vger.kernel.org
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
Link: https://patch.msgid.link/2b80a77a-06db-4dd7-85dc-3a8e0de55a1d@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
966c529aa1
commit
e88fbc30dd
@@ -1750,16 +1750,17 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
|
||||
static void ftgmac100_phy_disconnect(struct net_device *netdev)
|
||||
{
|
||||
struct ftgmac100 *priv = netdev_priv(netdev);
|
||||
struct phy_device *phydev = netdev->phydev;
|
||||
|
||||
if (!netdev->phydev)
|
||||
if (!phydev)
|
||||
return;
|
||||
|
||||
phy_disconnect(netdev->phydev);
|
||||
phy_disconnect(phydev);
|
||||
if (of_phy_is_fixed_link(priv->dev->of_node))
|
||||
of_phy_deregister_fixed_link(priv->dev->of_node);
|
||||
|
||||
if (priv->use_ncsi)
|
||||
fixed_phy_unregister(netdev->phydev);
|
||||
fixed_phy_unregister(phydev);
|
||||
}
|
||||
|
||||
static void ftgmac100_destroy_mdio(struct net_device *netdev)
|
||||
|
||||
Reference in New Issue
Block a user