From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@kernel.org, andrew+netdev@lunn.ch,
netdev@vger.kernel.org
Cc: Richard Patel <ripatel@wii.dev>,
anthony.l.nguyen@intel.com, xiaolinkui@kylinos.cn,
xiaolinkui@126.com, tomasz.lichwala@linux.intel.com,
runyu.xiao@seu.edu.cn, stephend@silicom-usa.com,
f.fainelli@gmail.com, Andrew Lunn <andrew@lunn.ch>,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
Simon Horman <horms@kernel.org>,
Sunitha Mekala <sunithax.d.mekala@intel.com>
Subject: [PATCH net 1/4] ixgbe: fix MDIO bus lifetime
Date: Fri, 20 Nov 2026 14:00:17 -0800 [thread overview]
Message-ID: <20261120220022.3133664-2-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20261120220022.3133664-1-anthony.l.nguyen@intel.com>
From: Richard Patel <ripatel@wii.dev>
Plugging in an unsupported SFP module caused ixgbe NICs to get
wedged permanently.
ixgbe unregisters the netdev when rejecting an SFP transceiver as
unsupported.
ixgbe 0000:3b:00.0: failed to initialize because an unsupported SFP+ module type was detected.
ixgbe 0000:3b:00.0: Reload the driver after installing a supported module.
ixgbe 0000:3b:00.0: removed PHC on enp59s0
This code path failed to unregister an MDIO bus owned by that
netdev, so when unregister_netdev() tries to tear it down
(via device_del() -> devres_release_all() -> mdiobus_free()),
it trips over the leaked registration.
ixgbe-mdio-0000:3b:00.0: not in UNREGISTERED state
WARNING: drivers/net/phy/mdio_bus_provider.c:711 at mdiobus_free+0x3d/0x50, CPU#21: kworker/u128:0/12
This prevents ixgbe from reloading, even after PCIe remove/rescan:
sysfs: cannot create duplicate filename '/class/mdio_bus/ixgbe-mdio-0000:3b:00.0'
Switch to devm_mdiobus_register(), drop custom unregister calls.
This is safe because the bus is already devm-allocated, so unregister
always happens before free.
Fixes: 8fa10ef01260 ("ixgbe: register a mdiobus")
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Richard Patel <ripatel@wii.dev>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Sunitha Mekala <sunithax.d.mekala@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 9 ++-------
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 2 +-
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index b9496f0bee13..2b6d1177adda 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8471,6 +8471,7 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter)
e_dev_err("Reload the driver after installing a "
"supported module.\n");
unregister_netdev(adapter->netdev);
+ adapter->mii_bus = NULL;
}
}
@@ -8693,11 +8694,8 @@ static void ixgbe_service_task(struct work_struct *work)
}
if (ixgbe_check_fw_error(adapter)) {
if (!test_bit(__IXGBE_DOWN, &adapter->state)) {
- if (adapter->mii_bus) {
- mdiobus_unregister(adapter->mii_bus);
- adapter->mii_bus = NULL;
- }
unregister_netdev(adapter->netdev);
+ adapter->mii_bus = NULL;
}
ixgbe_service_event_complete(adapter);
return;
@@ -12110,9 +12108,6 @@ static void ixgbe_remove(struct pci_dev *pdev)
if (adapter->hw.mac.type == ixgbe_mac_e610)
ixgbe_disable_link_status_events(adapter);
- if (adapter->mii_bus)
- mdiobus_unregister(adapter->mii_bus);
-
#ifdef CONFIG_IXGBE_DCA
if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) {
adapter->flags &= ~IXGBE_FLAG_DCA_ENABLED;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index ab733e73927d..74631cb2ddbc 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -1086,7 +1086,7 @@ int ixgbe_mii_bus_init(struct ixgbe_hw *hw)
hw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22;
adapter->mii_bus = bus;
- return mdiobus_register(bus);
+ return devm_mdiobus_register(dev, bus);
}
/**
--
2.47.1
next prev parent reply other threads:[~2026-11-20 22:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 22:00 [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2026-11-20 (ixgbe, ixgbevf, fm10k) Tony Nguyen
2026-11-20 22:00 ` Tony Nguyen [this message]
2026-11-20 22:00 ` [PATCH net 2/4] ixgbe: fix incomplete ACI command buffer backup on retry Tony Nguyen
2026-11-20 22:00 ` [PATCH net 3/4] ixgbevf: fix link speed reporting for Hyper-V E610 VFs Tony Nguyen
2026-11-20 22:00 ` [PATCH net 4/4] net: fm10k: shut down the service timer during removal Tony Nguyen
2026-11-20 22:03 ` [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2026-11-20 (ixgbe, ixgbevf, fm10k) netdev-bot+sinfo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261120220022.3133664-2-anthony.l.nguyen@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ripatel@wii.dev \
--cc=runyu.xiao@seu.edu.cn \
--cc=stephend@silicom-usa.com \
--cc=sunithax.d.mekala@intel.com \
--cc=tomasz.lichwala@linux.intel.com \
--cc=xiaolinkui@126.com \
--cc=xiaolinkui@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox