* [PATCH net-next 1/4] igc: Support ACPI-based MAC passthrough
2026-12-03 0:50 [PATCH net-next 0/4][pull request] Intel Wired LAN Driver Updates 2026-12-02 (igc, igb, e100) Tony Nguyen
@ 2026-12-03 0:50 ` Tony Nguyen
2026-12-04 1:07 ` netdev-bot+sashiko
2026-12-03 0:50 ` [PATCH net-next 2/4] igb: detect M88E1112 100BASE-FX SGMII mode Tony Nguyen
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Tony Nguyen @ 2026-12-03 0:50 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev
Cc: Dima Ruinskiy, anthony.l.nguyen, paweldembicki,
pavankumaryalagada, Chia-Lin Kao (AceLan), Narpat Mali,
Jose Ignacio Tornos Martinez
From: Dima Ruinskiy <dima.ruinskiy@intel.com>
Some systems implement a system MAC address object in the ACPI table,
using either \\_SB.AMAC or \\MACA object names. This system MAC address,
when enabled, is intended to override the permanent MAC address of the
any network controller attached via a docking station. The purpose is to
allow the host PC retain its network identity in a corporate environment,
regardless of the specific docking station it is connected to. The
expectation is that only one docking station is attached at a time, or
that only a single network controller is plugged in at a time.
Implement seamless passthrough of the system MAC address to the
I225/I226 network controller, by looking up the relevant ACPI object names
and using them to initialize the MAC address. Limit the lookup only to
controllers that are Thunderbolt-attached, as these are the only docking
stations that can pass through an I225/I226 controller to the host.
On systems where the feature is disabled or unsupported, the ACPI objects
do not exist or do not contain a valid Ethernet MAC, the default MAC
address of the device is used.
Signed-off-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
Tested-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Tested-by: Narpat Mali <narpat.mali@dell.com>
Reviewed-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/igc/igc_main.c | 70 +++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 1fb5f3cbe93c..1c7fb61f1041 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018 Intel Corporation */
+#include <linux/acpi.h>
+#include <linux/hex.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/if_vlan.h>
@@ -7106,6 +7108,58 @@ static enum hrtimer_restart igc_qbv_scheduling_timer(struct hrtimer *timer)
return HRTIMER_NORESTART;
}
+static bool igc_get_acpi_mac_passthru(u8 *mac)
+{
+ static const struct {
+ const char *name;
+ acpi_object_type type;
+ u32 length;
+ } sources[] = {
+ { "\\_SB.AMAC", ACPI_TYPE_BUFFER, 23 },
+ { "\\MACA", ACPI_TYPE_STRING, 22 },
+ };
+ struct acpi_buffer buffer;
+ union acpi_object *obj;
+ bool mac_found = false;
+ acpi_status status;
+ u8 buf[ETH_ALEN] __aligned(2);
+ int i;
+
+ if (!IS_ENABLED(CONFIG_ACPI))
+ return false;
+
+ for (i = 0; i < ARRAY_SIZE(sources) && !mac_found; i++) {
+ buffer.length = ACPI_ALLOCATE_BUFFER;
+ buffer.pointer = NULL;
+
+ status = acpi_evaluate_object(NULL, (char *)sources[i].name,
+ NULL, &buffer);
+ if (ACPI_FAILURE(status))
+ continue;
+
+ obj = buffer.pointer;
+ if (!obj || obj->type != sources[i].type ||
+ obj->string.length != sources[i].length ||
+ !obj->string.pointer)
+ goto free_obj;
+
+ if (strncmp(obj->string.pointer, "_AUXMAC_#", 9) ||
+ obj->string.pointer[21] != '#')
+ goto free_obj;
+
+ if (hex2bin(buf, obj->string.pointer + 9, ETH_ALEN) ||
+ !is_valid_ether_addr(buf))
+ goto free_obj;
+
+ ether_addr_copy(mac, buf);
+ mac_found = true;
+free_obj:
+ ACPI_FREE(obj);
+ }
+
+ return mac_found;
+}
+
/**
* igc_probe - Device Initialization Routine
* @pdev: PCI device information struct
@@ -7272,6 +7326,22 @@ static int igc_probe(struct pci_dev *pdev,
/* copy the MAC address out of the NVM */
if (hw->mac.ops.read_mac_addr(hw))
dev_err(&pdev->dev, "NVM Read Error\n");
+
+ /* For devices behind a Thunderbolt/USB4 dock, look for a
+ * system-provided MAC in the ACPI table
+ */
+ if (pci_is_thunderbolt_attached(pdev) &&
+ igc_get_acpi_mac_passthru(hw->mac.addr)) {
+ /* Set the permanent MAC address. Leave blank if invalid
+ * to reflect there is something wrong with the NVM MAC.
+ */
+ if (is_valid_ether_addr(hw->mac.perm_addr))
+ ether_addr_copy(netdev->perm_addr, hw->mac.perm_addr);
+ netdev->addr_assign_type = NET_ADDR_STOLEN;
+ dev_info(&pdev->dev,
+ "Using ACPI pass-thru MAC addr %pM\n",
+ hw->mac.addr);
+ }
}
eth_hw_addr_set(netdev, hw->mac.addr);
--
2.47.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH net-next 1/4] igc: Support ACPI-based MAC passthrough
2026-12-03 0:50 ` [PATCH net-next 1/4] igc: Support ACPI-based MAC passthrough Tony Nguyen
@ 2026-12-04 1:07 ` netdev-bot+sashiko
2026-12-04 1:28 ` Andrew Lunn
0 siblings, 1 reply; 11+ messages in thread
From: netdev-bot+sashiko @ 2026-12-04 1:07 UTC (permalink / raw)
To: anthony.l.nguyen
Cc: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev,
paweldembicki, dima.ruinskiy, pavankumaryalagada, sx.rinitha
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] igc_probe() (drivers/net/ethernet/intel/igc/igc_main.c, ~line
7333) replaces the NVM MAC with the ACPI system MAC for every…
- [Low] The new comment in igc_probe() says the ACPI lookup is for
'devices behind a Thunderbolt/USB4 dock'.
- [Low] The patch adds ether_addr_copy(netdev->perm_addr,
hw->mac.perm_addr) in igc_probe()…
--
igc: Support ACPI-based MAC passthrough
With this patch, igc_probe() looks for a system MAC address in the ACPI
\_SB.AMAC or \MACA objects when the I225/I226 controller is
Thunderbolt-attached. If it finds a valid "_AUXMAC_#...#" MAC, that MAC
replaces the NVM MAC and the netdev is marked NET_ADDR_STOLEN.
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
> index 1fb5f3cbe93c5..1c7fb61f10411 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
[ ... ]
> @@ -7272,6 +7326,22 @@ static int igc_probe(struct pci_dev *pdev,
> /* copy the MAC address out of the NVM */
> if (hw->mac.ops.read_mac_addr(hw))
> dev_err(&pdev->dev, "NVM Read Error\n");
> +
> + /* For devices behind a Thunderbolt/USB4 dock, look for a
> + * system-provided MAC in the ACPI table
> + */
[Severity: Low]
Does this check really cover USB4 docks, as the comment says?
pci_is_thunderbolt_attached() only checks pdev->is_thunderbolt on the
device and its upstream bridges:
include/linux/pci.h:pci_is_thunderbolt_attached() {
if (pdev->is_thunderbolt)
return true;
while ((parent = pci_upstream_bridge(parent)))
if (parent->is_thunderbolt)
return true;
...
}
set_pcie_thunderbolt() in drivers/pci/probe.c only sets that flag when the
Intel TBT VSEC is present:
vsec = pci_find_vsec_capability(dev, PCI_VENDOR_ID_INTEL, PCI_VSEC_ID_INTEL_TBT);
Take an I225/I226 tunneled through a non-Intel USB4 host and dock. It
would fail this check, so igc_get_acpi_mac_passthru() is never called.
The NVM MAC is then used and nothing is logged.
The commit message has the same gap:
Limit the lookup only to controllers that are Thunderbolt-attached, as
these are the only docking stations that can pass through an I225/I226
controller to the host.
For comparison, amdgpu_device_detect_runtime_pm_mode() pairs
pci_is_thunderbolt_attached() with dev_is_removable() to catch these
devices.
Should the comment and commit message say Thunderbolt only, or should the
check be extended?
> + if (pci_is_thunderbolt_attached(pdev) &&
> + igc_get_acpi_mac_passthru(hw->mac.addr)) {
[Severity: Medium]
Can more than one interface end up with the same MAC address here?
igc_get_acpi_mac_passthru() evaluates a global ACPI object with a NULL
handle:
status = acpi_evaluate_object(NULL, (char *)sources[i].name,
NULL, &buffer);
So every caller gets the same 6 bytes.
Nothing in igc_probe() ties the NIC to a specific dock. Nothing records
that the MAC has already been claimed, and there is no way to opt out.
Every probe that passes pci_is_thunderbolt_attached() gets the same
dev_addr. igc_reset()->igc_init_rx_addrs()->rar_set() then programs that
address into RAR[0] on each device.
Some setups where this would happen:
- both ports of a dual-port I225/I226 card in a Thunderbolt PCIe enclosure
- a generic Thunderbolt-attached I225/I226 adapter that is not an OEM dock
- daisy-chained docks that each contain an I225/I226
- an igc dock NIC next to an r8152 dock that also does passthrough
If those interfaces share an L2 segment, ARP/ND entries would flap between
them. A device that is not a dock could also take on the corporate system
identity.
The commit message calls single attachment an "expectation":
The expectation is that only one docking station is attached at a
time, or that only a single network controller is plugged in at a
time.
The code does not enforce this.
r8152, the existing in-tree user of these ACPI objects, checks the device
first:
- It uses \MACA only for whitelisted Lenovo dock VID/PIDs, in
rtl8152_supports_lenovo_macpassthru().
- In vendor_mac_passthru_addr_read(), it uses \_SB.AMAC only after
checking the RTL8153-AD eFuse passthrough bit or the RTL8153-BND/BD
variants.
Does this need some check that the device is a qualified dock NIC, or a
guard against handing the same MAC out twice?
> + /* Set the permanent MAC address. Leave blank if invalid
> + * to reflect there is something wrong with the NVM MAC.
> + */
> + if (is_valid_ether_addr(hw->mac.perm_addr))
> + ether_addr_copy(netdev->perm_addr, hw->mac.perm_addr);
[Severity: Low]
Is this call within ether_addr_copy()'s alignment rule?
The kernel-doc for ether_addr_copy() says "dst & src must both be aligned
to u16".
In struct net_device, perm_addr follows unsigned int operstate and three
unsigned char fields (link_mode, if_port, dma). That puts perm_addr at an
odd offset.
Without CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, ether_addr_copy() does
three u16 stores through a cast pointer. On strict-alignment CPUs those
stores would hit an odd address. Examples are RISC-V without
RISCV_EFFICIENT_UNALIGNED_ACCESS and LoongArch with ARCH_STRICT_ALIGN.
The same patch marks the local buf in igc_get_acpi_mac_passthru() as
__aligned(2) to follow this rule.
Would memcpy(netdev->perm_addr, hw->mac.perm_addr, ETH_ALEN) be safer here?
> + netdev->addr_assign_type = NET_ADDR_STOLEN;
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203005042.348952-1-anthony.l.nguyen%40intel.com
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH net-next 1/4] igc: Support ACPI-based MAC passthrough
2026-12-04 1:07 ` netdev-bot+sashiko
@ 2026-12-04 1:28 ` Andrew Lunn
0 siblings, 0 replies; 11+ messages in thread
From: Andrew Lunn @ 2026-12-04 1:28 UTC (permalink / raw)
To: netdev-bot+sashiko
Cc: anthony.l.nguyen, davem, kuba, pabeni, edumazet, andrew+netdev,
willemb, netdev, paweldembicki, dima.ruinskiy, pavankumaryalagada,
sx.rinitha
> igc: Support ACPI-based MAC passthrough
>
> With this patch, igc_probe() looks for a system MAC address in the ACPI
> \_SB.AMAC or \MACA objects when the I225/I226 controller is
> Thunderbolt-attached. If it finds a valid "_AUXMAC_#...#" MAC, that MAC
> replaces the NVM MAC and the netdev is marked NET_ADDR_STOLEN.
MAC passthrough is a big can of worms with all sorts of corner cases
breaking systems. In general, don't do it. If you do do it, expect it
to get reverted at least once, maybe more times. That is what history
shows.
> > + if (pci_is_thunderbolt_attached(pdev) &&
> > + igc_get_acpi_mac_passthru(hw->mac.addr)) {
>
> [Severity: Medium]
> Can more than one interface end up with the same MAC address here?
>
> igc_get_acpi_mac_passthru() evaluates a global ACPI object with a NULL
> handle:
>
> status = acpi_evaluate_object(NULL, (char *)sources[i].name,
> NULL, &buffer);
>
> So every caller gets the same 6 bytes.
>
> Nothing in igc_probe() ties the NIC to a specific dock. Nothing records
> that the MAC has already been claimed, and there is no way to opt out.
>
> Every probe that passes pci_is_thunderbolt_attached() gets the same
> dev_addr. igc_reset()->igc_init_rx_addrs()->rar_set() then programs that
> address into RAR[0] on each device.
>
> Some setups where this would happen:
>
> - both ports of a dual-port I225/I226 card in a Thunderbolt PCIe enclosure
> - a generic Thunderbolt-attached I225/I226 adapter that is not an OEM dock
> - daisy-chained docks that each contain an I225/I226
> - an igc dock NIC next to an r8152 dock that also does passthrough
See the worms wriggling in the can...
Andrew
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net-next 2/4] igb: detect M88E1112 100BASE-FX SGMII mode
2026-12-03 0:50 [PATCH net-next 0/4][pull request] Intel Wired LAN Driver Updates 2026-12-02 (igc, igb, e100) Tony Nguyen
2026-12-03 0:50 ` [PATCH net-next 1/4] igc: Support ACPI-based MAC passthrough Tony Nguyen
@ 2026-12-03 0:50 ` Tony Nguyen
2026-12-04 1:07 ` netdev-bot+sashiko
2026-12-03 0:50 ` [PATCH net-next 3/4] igb: read SFP module EEPROM through igb_read_sfp_data_byte Tony Nguyen
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Tony Nguyen @ 2026-12-03 0:50 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev
Cc: Pawel Dembicki, anthony.l.nguyen, dima.ruinskiy,
pavankumaryalagada, Rinitha S
From: Pawel Dembicki <paweldembicki@gmail.com>
The M88E1112 can be strapped or EEPROM-configured to bridge SGMII
to 100BASE-FX. In this mode the driver still needs the SGMII PHY
register access path to identify the external PHY, but the MAC link
setup must follow the SERDES media path rather than copper setup.
Decode the M88E1112 MAC Control 1 mode field and switch the I210
media type and physical interface setup callback when the PHY reports
100BASE-FX mode.
The driver only observes the Marvell mode. It does not program the
88E1112 registers or its EEPROM. The board must configure it
through firmware or straps before probe.
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/igb/e1000_82575.c | 12 +++++++++++-
drivers/net/ethernet/intel/igb/e1000_defines.h | 1 +
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index 44a85ad749a4..72c42d9d6f47 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -264,9 +264,19 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
data = FIELD_GET(E1000_M88E1112_MAC_CTRL_1_MODE_MASK,
data);
if (data == E1000_M88E1112_AUTO_COPPER_SGMII ||
- data == E1000_M88E1112_AUTO_COPPER_BASEX)
+ data == E1000_M88E1112_AUTO_COPPER_BASEX) {
hw->mac.ops.check_for_link =
igb_check_for_link_media_swap;
+ } else if (data == E1000_M88E1112_100BASE_FX) {
+ /* The driver only detects this strap/EEPROM
+ * mode. 88E1112 register and EEPROM setup must
+ * be done outside igb before probe/reset.
+ */
+ hw->phy.media_type =
+ e1000_media_type_internal_serdes;
+ hw->mac.ops.setup_physical_interface =
+ igb_setup_serdes_link_82575;
+ }
}
if (phy->id == M88E1512_E_PHY_ID) {
ret_val = igb_initialize_M88E1512_phy(hw);
diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h
index 7e6f9aa2d57b..25104328eae6 100644
--- a/drivers/net/ethernet/intel/igb/e1000_defines.h
+++ b/drivers/net/ethernet/intel/igb/e1000_defines.h
@@ -615,6 +615,7 @@
#define E1000_MEDIA_PORT_COPPER 1
#define E1000_MEDIA_PORT_OTHER 2
+#define E1000_M88E1112_100BASE_FX 0x0
#define E1000_M88E1112_AUTO_COPPER_SGMII 0x2
#define E1000_M88E1112_AUTO_COPPER_BASEX 0x3
#define E1000_M88E1112_STATUS_LINK 0x0004 /* Interface Link Bit */
--
2.47.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH net-next 2/4] igb: detect M88E1112 100BASE-FX SGMII mode
2026-12-03 0:50 ` [PATCH net-next 2/4] igb: detect M88E1112 100BASE-FX SGMII mode Tony Nguyen
@ 2026-12-04 1:07 ` netdev-bot+sashiko
0 siblings, 0 replies; 11+ messages in thread
From: netdev-bot+sashiko @ 2026-12-04 1:07 UTC (permalink / raw)
To: anthony.l.nguyen
Cc: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev,
paweldembicki, dima.ruinskiy, pavankumaryalagada, sx.rinitha
Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The new M88E1112 100BASE-FX path does not set up the same
state as the existing 100BASE-FX path.
- [Medium] The commit message says "The driver only observes the Marvell
mode.
- [Medium] Once the new branch sets hw->phy.media_type =
e1000_media_type_internal_serdes, igb_power_down_link()…
- [Low] The commit message says the patch will "switch the I210 media
type and physical interface setup callback" when the PHY is in…
- [Low] igb_init_phy_params_82575() normally keeps phy->type and
media_type consistent.
--
igb: detect M88E1112 100BASE-FX SGMII mode
This patch decodes the M88E1112 MAC Control 1 mode field in
igb_init_phy_params_82575(). When the PHY reports 100BASE-FX mode, it
switches the media type to internal serdes and the physical interface
setup callback to igb_setup_serdes_link_82575(). The PHY is expected to be
configured by straps or EEPROM before probe.
> diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
> index 44a85ad749a4a..72c42d9d6f475 100644
> --- a/drivers/net/ethernet/intel/igb/e1000_82575.c
> +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
> @@ -264,9 +264,19 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
> data = FIELD_GET(E1000_M88E1112_MAC_CTRL_1_MODE_MASK,
> data);
> if (data == E1000_M88E1112_AUTO_COPPER_SGMII ||
> - data == E1000_M88E1112_AUTO_COPPER_BASEX)
> + data == E1000_M88E1112_AUTO_COPPER_BASEX) {
> hw->mac.ops.check_for_link =
> igb_check_for_link_media_swap;
> + } else if (data == E1000_M88E1112_100BASE_FX) {
[Severity: Low]
The commit message says:
Decode the M88E1112 MAC Control 1 mode field and switch the I210
media type and physical interface setup callback when the PHY reports
100BASE-FX mode.
Is this branch meant to apply only to I210? There is no hw->mac.type check
here. The only conditions are phy->id == M88E1112_E_PHY_ID and a mode field
of 0.
igb_get_invariants_82575() calls igb_init_phy_params_82575() for every igb
MAC type (82575, 82576, 82580, i350, i354, i210, i211). Any of those boards
with an M88E1112 reporting mode 000 would now take the serdes path.
Could the commit message describe the actual scope? Alternatively, should
this branch check the MAC type?
> + /* The driver only detects this strap/EEPROM
> + * mode. 88E1112 register and EEPROM setup must
> + * be done outside igb before probe/reset.
> + */
[Severity: Medium]
Does this comment still hold in the new mode? The commit message also says
"It does not program the 88E1112 registers or its EEPROM".
Earlier in igb_init_phy_params_82575(), the SGMII path installs:
phy->ops.reset = igb_phy_hw_reset_sgmii_82575;
This branch leaves that in place. igb_power_up_link() calls igb_reset_phy()
whatever the media type is. So on every open, resume and self-test, this
sequence runs:
igb_power_up_link()
igb_reset_phy()
igb_phy_hw_reset_sgmii_82575()
hw->phy.ops.write_reg(hw, 0x1B, 0x8084);
igb_phy_sw_reset(hw);
The detection code also left the page register at 2:
ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 2);
Wouldn't these writes then land on the 88E1112 page 2 (MAC-side) registers?
In the existing SFP 100BASE-FX path, igb_init_phy_params_82575() returns
early and no reset op is installed, so igb_reset_phy() does nothing there.
Should this branch clear phy->ops.reset and restore page 0?
> + hw->phy.media_type =
> + e1000_media_type_internal_serdes;
[Severity: Medium]
Should dev_spec->_82575.eth_flags.e100_base_fx also be set here?
The existing 100BASE-FX path in igb_set_sfp_media_type_82575() always sets
the flag together with the serdes media type:
} else if (eth_flags->e100_base_fx || eth_flags->e100_base_lx) {
dev_spec->sgmii_active = true;
hw->phy.media_type = e1000_media_type_internal_serdes;
The ethtool code checks the flag, not media_type. In
igb_get_link_ksettings():
if (eth_flags->e100_base_fx || eth_flags->e100_base_lx) {
supported |= SUPPORTED_100baseT_Full;
advertising |= ADVERTISED_100baseT_Full;
}
So in the new mode, ethtool would list only 1000baseKX_Full while the
reported speed is 100.
In igb_set_pauseparam():
/* 100basefx does not support setting link flow control */
if (hw->dev_spec._82575.eth_flags.e100_base_fx)
return -EINVAL;
So flow control changes would now be accepted for this 100BASE-FX link.
They also trigger a reset that reprograms the PCS pause advertisement.
[Severity: Low]
Can leaving phy->type as e1000_phy_m88 lead to copper register reads on this
serdes link?
At the top of igb_init_phy_params_82575(), non-copper media always ends up
with phy_none:
if (hw->phy.media_type != e1000_media_type_copper) {
phy->type = e1000_phy_none;
goto out;
}
This branch changes media_type after phy->type and the M88 ops are already
set. igb_watchdog_task() calls igb_check_downshift() on every link-up, and
igb_check_downshift() only looks at phy->type:
case e1000_phy_m88:
...
offset = M88E1000_PHY_SPEC_STATUS;
mask = M88E1000_PSSR_DOWNSHIFT;
...
ret_val = phy->ops.read_reg(hw, offset, &phy_data);
With the page register still at 2, this reads a page 2 register instead of
the copper PHY Specific Status register.
If bit 5 is set in that register, would "Link Speed was downgraded by
SmartSpeed" be logged on every link-up?
[Severity: Medium]
What powers down the external 88E1112 after this change?
With media_type set to internal serdes, igb_power_down_link() no longer
calls igb_power_down_phy_copper_82575():
if (adapter->hw.phy.media_type == e1000_media_type_copper)
igb_power_down_phy_copper_82575(&adapter->hw);
else
igb_shutdown_serdes_link_82575(&adapter->hw);
igb_shutdown_serdes_link_82575() does not return early in this mode,
because media_type is internal serdes. It only clears PCS_CFG0.PCS_EN and
sets CTRL_EXT.SDP3_DATA ("shutdown the laser"). It never touches the PHY.
On ifdown, or on suspend without WoL, could the 88E1112 stay powered with
its fiber transmitter on, so the link partner still sees link?
SDP3 is also now toggled on every power-down and power-up. On a board with
an on-board 88E1112, that pin is not necessarily an SFP TX_DISABLE pin.
> + hw->mac.ops.setup_physical_interface =
> + igb_setup_serdes_link_82575;
> + }
> }
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203005042.348952-1-anthony.l.nguyen%40intel.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net-next 3/4] igb: read SFP module EEPROM through igb_read_sfp_data_byte
2026-12-03 0:50 [PATCH net-next 0/4][pull request] Intel Wired LAN Driver Updates 2026-12-02 (igc, igb, e100) Tony Nguyen
2026-12-03 0:50 ` [PATCH net-next 1/4] igc: Support ACPI-based MAC passthrough Tony Nguyen
2026-12-03 0:50 ` [PATCH net-next 2/4] igb: detect M88E1112 100BASE-FX SGMII mode Tony Nguyen
@ 2026-12-03 0:50 ` Tony Nguyen
2026-12-04 1:07 ` netdev-bot+sashiko
2026-12-03 0:50 ` [PATCH net-next 4/4] e100: prevent shift-out-of-bounds in EEPROM access Tony Nguyen
2026-12-03 0:53 ` [PATCH net-next 0/4][pull request] Intel Wired LAN Driver Updates 2026-12-02 (igc, igb, e100) netdev-bot+sinfo
4 siblings, 1 reply; 11+ messages in thread
From: Tony Nguyen @ 2026-12-03 0:50 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev
Cc: Pawel Dembicki, anthony.l.nguyen, dima.ruinskiy,
pavankumaryalagada, Rinitha S
From: Pawel Dembicki <paweldembicki@gmail.com>
igb_get_module_info() and igb_get_module_eeprom() use
igb_read_phy_reg_i2c(), which accesses the external PHY register space.
On designs with an external SGMII PHY this returns PHY register contents
instead of the SFP module EEPROM requested by ethtool -m.
Use igb_read_sfp_data_byte() for module EEPROM reads. The legacy
ethtool module EEPROM offset space maps directly to the I210 I2CCMD
module address space: offsets 0x000-0x0ff address the SFP base EEPROM
and offsets 0x100-0x1ff address the diagnostics EEPROM.
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/igb/igb_ethtool.c | 39 ++++++--------------
1 file changed, 12 insertions(+), 27 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index ccc7302dc7bd..12d449bb062e 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -3208,7 +3208,7 @@ static int igb_get_module_info(struct net_device *netdev,
struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
u32 status = 0;
- u16 sff8472_rev, addr_mode;
+ u8 sff8472_rev, addr_mode;
bool page_swap = false;
if ((hw->phy.media_type == e1000_media_type_copper) ||
@@ -3216,22 +3216,26 @@ static int igb_get_module_info(struct net_device *netdev,
return -EOPNOTSUPP;
/* Check whether we support SFF-8472 or not */
- status = igb_read_phy_reg_i2c(hw, IGB_SFF_8472_COMP, &sff8472_rev);
+ status = igb_read_sfp_data_byte(hw,
+ E1000_I2CCMD_SFP_DATA_ADDR(IGB_SFF_8472_COMP),
+ &sff8472_rev);
if (status)
return -EIO;
/* addressing mode is not supported */
- status = igb_read_phy_reg_i2c(hw, IGB_SFF_8472_SWAP, &addr_mode);
+ status = igb_read_sfp_data_byte(hw,
+ E1000_I2CCMD_SFP_DATA_ADDR(IGB_SFF_8472_SWAP),
+ &addr_mode);
if (status)
return -EIO;
/* addressing mode is not supported */
- if ((addr_mode & 0xFF) & IGB_SFF_ADDRESSING_MODE) {
+ if (addr_mode & IGB_SFF_ADDRESSING_MODE) {
hw_dbg("Address change required to access page 0xA2, but not supported. Please report the module type to the driver maintainers.\n");
page_swap = true;
}
- if ((sff8472_rev & 0xFF) == IGB_SFF_8472_UNSUP || page_swap) {
+ if (sff8472_rev == IGB_SFF_8472_UNSUP || page_swap) {
/* We have an SFP, but it does not support SFF-8472 */
modinfo->type = ETH_MODULE_SFF_8079;
modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
@@ -3250,36 +3254,17 @@ static int igb_get_module_eeprom(struct net_device *netdev,
struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
u32 status = 0;
- u16 *dataword;
- u16 first_word, last_word;
int i = 0;
if (ee->len == 0)
return -EINVAL;
- first_word = ee->offset >> 1;
- last_word = (ee->offset + ee->len - 1) >> 1;
-
- dataword = kmalloc_objs(u16, last_word - first_word + 1);
- if (!dataword)
- return -ENOMEM;
-
- /* Read EEPROM block, SFF-8079/SFF-8472, word at a time */
- for (i = 0; i < last_word - first_word + 1; i++) {
- status = igb_read_phy_reg_i2c(hw, (first_word + i) * 2,
- &dataword[i]);
- if (status) {
- /* Error occurred while reading module */
- kfree(dataword);
+ for (i = 0; i < ee->len; i++) {
+ status = igb_read_sfp_data_byte(hw, ee->offset + i, &data[i]);
+ if (status)
return -EIO;
- }
-
- be16_to_cpus(&dataword[i]);
}
- memcpy(data, (u8 *)dataword + (ee->offset & 1), ee->len);
- kfree(dataword);
-
return 0;
}
--
2.47.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH net-next 3/4] igb: read SFP module EEPROM through igb_read_sfp_data_byte
2026-12-03 0:50 ` [PATCH net-next 3/4] igb: read SFP module EEPROM through igb_read_sfp_data_byte Tony Nguyen
@ 2026-12-04 1:07 ` netdev-bot+sashiko
0 siblings, 0 replies; 11+ messages in thread
From: netdev-bot+sashiko @ 2026-12-04 1:07 UTC (permalink / raw)
To: anthony.l.nguyen
Cc: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev,
paweldembicki, dima.ruinskiy, pavankumaryalagada, sx.rinitha
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] Series ordering creates a bisect window, and the commit message
gives no context for it.
- [Low] igb_get_module_eeprom()
(drivers/net/ethernet/intel/igb/igb_ethtool.c) now does one I2CCMD…
--
igb: read SFP module EEPROM through igb_read_sfp_data_byte
This patch moves igb_get_module_info() and igb_get_module_eeprom() off
igb_read_phy_reg_i2c(), which addresses the external PHY register space.
They now use igb_read_sfp_data_byte(), which addresses the SFP module
EEPROM. The module EEPROM is read one byte at a time through I2CCMD.
> igb_get_module_info() and igb_get_module_eeprom() use
> igb_read_phy_reg_i2c(), which accesses the external PHY register space.
> On designs with an external SGMII PHY this returns PHY register contents
> instead of the SFP module EEPROM requested by ethtool -m.
[Severity: Low]
Can this problem be reached before the previous patch in this series,
"igb: detect M88E1112 100BASE-FX SGMII mode"?
Before that patch, igb_init_phy_params_82575() returned early for any
non-copper media. So phy->addr was never pointed at an external PHY while
media_type was serdes:
drivers/net/ethernet/intel/igb/e1000_82575.c:igb_init_phy_params_82575() {
...
if (hw->phy.media_type != e1000_media_type_copper) {
phy->type = e1000_phy_none;
goto out;
}
...
}
The previous patch adds a 100BASE-FX branch. It switches to serdes after
igb_get_phy_id_82575() has already set phy->addr to the M88E1112 address:
} else if (data == E1000_M88E1112_100BASE_FX) {
...
hw->phy.media_type =
e1000_media_type_internal_serdes;
igb_get_module_info() and igb_get_module_eeprom() return -EOPNOTSUPP for
copper and unknown media. So these external SGMII PHY designs seem to reach
the old igb_read_phy_reg_i2c() path only after that patch is applied.
Consider an M88E1112 strapped for 100BASE-FX at that intermediate commit.
ethtool -m would report M88E1112 registers as module EEPROM data. It would
also choose SFF-8079 or SFF-8472 based on PHY registers 0x5C/0x5E.
Could this patch come before the 100BASE-FX detection patch? Could the
commit message also say which change makes this path reachable?
One case is unconfirmed. After a MAS media swap, get_invariants runs again
and igb_init_phy_params_82575() returns early, which might leave a stale
phy->addr. If that path can reach ethtool -m, the problem is older than
this series, and a Fixes: tag for stable may be appropriate.
> diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
> index ccc7302dc7bdb..12d449bb062ee 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
[ ... ]
> @@ -3250,36 +3254,17 @@ static int igb_get_module_eeprom(struct net_device *netdev,
> struct igb_adapter *adapter = netdev_priv(netdev);
> struct e1000_hw *hw = &adapter->hw;
> u32 status = 0;
> - u16 *dataword;
> - u16 first_word, last_word;
> int i = 0;
>
> if (ee->len == 0)
> return -EINVAL;
>
> - first_word = ee->offset >> 1;
> - last_word = (ee->offset + ee->len - 1) >> 1;
> -
> - dataword = kmalloc_objs(u16, last_word - first_word + 1);
> - if (!dataword)
> - return -ENOMEM;
> -
> - /* Read EEPROM block, SFF-8079/SFF-8472, word at a time */
> - for (i = 0; i < last_word - first_word + 1; i++) {
> - status = igb_read_phy_reg_i2c(hw, (first_word + i) * 2,
> - &dataword[i]);
> - if (status) {
> - /* Error occurred while reading module */
> - kfree(dataword);
> + for (i = 0; i < ee->len; i++) {
> + status = igb_read_sfp_data_byte(hw, ee->offset + i, &data[i]);
[Severity: Low]
Does this double the number of busy-waited I2CCMD transactions in
igb_get_module_eeprom()?
For a full dump with ee->len = ETH_MODULE_SFF_8472_LEN (512), this loop
issues 512 I2CCMD reads. The old word loop issued 256. Each read polls in
igb_read_sfp_data_byte():
for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) {
udelay(50);
data_local = rd32(E1000_I2CCMD);
if (data_local & E1000_I2CCMD_READY)
break;
}
This ethtool op runs with RTNL held.
Each I2CCMD read returns two bytes. The old code used both, one from bits
7:0 and one from bits 15:8. igb_read_sfp_data_byte() keeps only bits 7:0
and drops the other byte.
Could the module EEPROM still be read a word at a time from the SFP
address space? That would avoid the extra busy-wait time for ethtool -m.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203005042.348952-1-anthony.l.nguyen%40intel.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net-next 4/4] e100: prevent shift-out-of-bounds in EEPROM access
2026-12-03 0:50 [PATCH net-next 0/4][pull request] Intel Wired LAN Driver Updates 2026-12-02 (igc, igb, e100) Tony Nguyen
` (2 preceding siblings ...)
2026-12-03 0:50 ` [PATCH net-next 3/4] igb: read SFP module EEPROM through igb_read_sfp_data_byte Tony Nguyen
@ 2026-12-03 0:50 ` Tony Nguyen
2026-12-04 1:07 ` netdev-bot+sashiko
2026-12-03 0:53 ` [PATCH net-next 0/4][pull request] Intel Wired LAN Driver Updates 2026-12-02 (igc, igb, e100) netdev-bot+sinfo
4 siblings, 1 reply; 11+ messages in thread
From: Tony Nguyen @ 2026-12-03 0:50 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev
Cc: Yalagada Pavan Kumar, anthony.l.nguyen, dima.ruinskiy,
paweldembicki, syzbot+e0abb1d45ac291ebebeb, Aleksandr Loktionov
From: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>
When reading the EEPROM address length, e100_eeprom_read() can return
an invalid length. This value is then used as a shift count when
calculating eeprom_wc, resulting in a shift-out-of-bounds UBSAN warning.
Stop EEPROM address probing if the detected address length exceeds
the initial address length to prevent addr_len from underflowing.
Validate addr_len after reading it from the EEPROM in both
e100_eeprom_load() and e100_eeprom_save(), and return -EIO
if the value is zero or greater than 8.
Reported-by: syzbot+e0abb1d45ac291ebebeb@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e0abb1d45ac291ebebeb
Signed-off-by: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
---
drivers/net/ethernet/intel/e100.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index 29960762e64a..cd8190386652 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -744,7 +744,14 @@ static __le16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
* complete address. Use this to adjust addr_len. */
ctrl = ioread8(&nic->csr->eeprom_ctrl_lo);
if (!(ctrl & eedo) && i > 16) {
- *addr_len -= (i - 16);
+ u16 len = i - 16;
+
+ if (len > *addr_len) {
+ *addr_len = 0;
+ break;
+ }
+
+ *addr_len -= len;
i = 17;
}
@@ -765,7 +772,15 @@ static int e100_eeprom_load(struct nic *nic)
/* Try reading with an 8-bit addr len to discover actual addr len */
e100_eeprom_read(nic, &addr_len, 0);
- nic->eeprom_wc = 1 << addr_len;
+
+ if (!addr_len || addr_len > 8) {
+ netif_err(nic, probe, nic->netdev,
+ "Invalid EEPROM address length %u\n",
+ addr_len);
+ return -EIO;
+ }
+
+ nic->eeprom_wc = (u16)BIT(addr_len);
for (addr = 0; addr < nic->eeprom_wc; addr++) {
nic->eeprom[addr] = e100_eeprom_read(nic, &addr_len, addr);
@@ -791,7 +806,15 @@ static int e100_eeprom_save(struct nic *nic, u16 start, u16 count)
/* Try reading with an 8-bit addr len to discover actual addr len */
e100_eeprom_read(nic, &addr_len, 0);
- nic->eeprom_wc = 1 << addr_len;
+
+ if (!addr_len || addr_len > 8) {
+ netif_err(nic, probe, nic->netdev,
+ "Invalid EEPROM address length %u\n",
+ addr_len);
+ return -EIO;
+ }
+
+ nic->eeprom_wc = (u16)BIT(addr_len);
if (start + count >= nic->eeprom_wc)
return -EINVAL;
--
2.47.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH net-next 4/4] e100: prevent shift-out-of-bounds in EEPROM access
2026-12-03 0:50 ` [PATCH net-next 4/4] e100: prevent shift-out-of-bounds in EEPROM access Tony Nguyen
@ 2026-12-04 1:07 ` netdev-bot+sashiko
0 siblings, 0 replies; 11+ messages in thread
From: netdev-bot+sashiko @ 2026-12-04 1:07 UTC (permalink / raw)
To: anthony.l.nguyen
Cc: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev,
paweldembicki, dima.ruinskiy, pavankumaryalagada, sx.rinitha
Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · Low: 3 (1)
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The new validation in e100_eeprom_load() and e100_eeprom_save()
only rejects addr_len == 0 or addr_len > 8.
- [Medium] The patch checks addr_len only once, after the discovery read.
- [Low] This fixes a syzbot-reported bug in e100_eeprom_load() that
predates git, but the commit has no Fixes: tag and no stable Cc.
- [Low] This is an undisclosed behaviour change.
- [Low] The new error in e100_eeprom_save() is logged with netif_err(nic,
probe, ...), which uses the NETIF_MSG_PROBE class.
Pre-existing issues:
- [Low] This problem wasn't introduced by this patch, but
e100_set_eeprom() memcpys user data into the nic->eeprom cache (line…
--
e100: prevent shift-out-of-bounds in EEPROM access
This patch guards the addr_len adjustment in e100_eeprom_read() so it can
no longer underflow. It also adds addr_len validation to
e100_eeprom_load() and e100_eeprom_save(), which return -EIO when addr_len
is zero or above 8. It addresses a syzbot-reported shift-out-of-bounds when
computing eeprom_wc.
Closes: https://syzkaller.appspot.com/bug?extid=e0abb1d45ac291ebebeb
> When reading the EEPROM address length, e100_eeprom_read() can return
> an invalid length. This value is then used as a shift count when
> calculating eeprom_wc, resulting in a shift-out-of-bounds UBSAN warning.
[Severity: Low]
Is the shift warning the whole of the old problem? Before this patch, if
EEDO read low at i == 31, the old code did:
*addr_len -= (i - 16);
This wraps the u16 to 65529. On x86 and arm64 the masked 1 << addr_len
then gives eeprom_wc == 0. The checksum compare in e100_eeprom_load() then
indexes out of bounds:
if (cpu_to_le16(0xBABA - checksum) != nic->eeprom[nic->eeprom_wc - 1]) {
That is nic->eeprom[-1]. Later e100_eeprom_read() calls also shift
op_read << *addr_len by a huge count.
Could the commit message mention the out-of-bounds index? This fixes a
syzbot-reported bug that predates git, so should it also carry a tag like
this, plus a Cc to stable?
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
> index 29960762e64a8..cd81903866521 100644
> --- a/drivers/net/ethernet/intel/e100.c
> +++ b/drivers/net/ethernet/intel/e100.c
[ ... ]
> @@ -765,7 +772,15 @@ static int e100_eeprom_load(struct nic *nic)
>
> /* Try reading with an 8-bit addr len to discover actual addr len */
> e100_eeprom_read(nic, &addr_len, 0);
> - nic->eeprom_wc = 1 << addr_len;
> +
> + if (!addr_len || addr_len > 8) {
> + netif_err(nic, probe, nic->netdev,
> + "Invalid EEPROM address length %u\n",
> + addr_len);
> + return -EIO;
> + }
[Severity: Low]
Is this behaviour change intended? Take a board whose EEPROM is dead or
unresponsive, so EEDO reads low on the first clock.
Before this patch, addr_len wrapped and eeprom_wc became 0 on x86 and
arm64. The checksum compare failed, but with eeprom_bad_csum_allow=1
e100_eeprom_load() still returned 0. e100_probe() then carried on and
reported an invalid MAC address from the EEPROM.
With this patch, e100_eeprom_read() computes len = 15, which is greater
than 8, so it sets addr_len = 0. e100_eeprom_load() then returns -EIO
before the eeprom_bad_csum_allow check is reached, and e100_probe() fails
whatever the module parameter says.
Could the commit message say that eeprom_bad_csum_allow no longer helps
these boards?
> +
> + nic->eeprom_wc = (u16)BIT(addr_len);
>
> for (addr = 0; addr < nic->eeprom_wc; addr++) {
> nic->eeprom[addr] = e100_eeprom_read(nic, &addr_len, addr);
[Severity: Medium]
addr_len is only validated once, after the discovery read. What happens if
one of these per-word reads sees EEDO low at i >= 25?
The new break path in e100_eeprom_read() sets *addr_len = 0. It then
returns data that holds only command-phase EEDO samples, with no failure
signal. That value is stored in nic->eeprom[addr] as if it were a real
word.
The rest of the loop then runs with addr_len == 0, while eeprom_wc stays
at 256. In that state this line puts the address bits on top of the start
bit and opcode:
cmd_addr_data = ((op_read << *addr_len) | addr) << 16;
For addr 0x98 the frame is 0x9E << 16, which the chip sees as 1 00 11
(EWEN). Addresses 0xA0-0xBF encode 1 01 (WRITE), and 0xE0-0xFF encode
1 11 (ERASE).
Depending on how the EEPROM handles these frames, can a read-only load
enable writes and then erase or overwrite EEPROM cells? Would it be safer
to check addr_len inside this loop and return -EIO if it changes?
> @@ -791,7 +806,15 @@ static int e100_eeprom_save(struct nic *nic, u16 start, u16 count)
>
> /* Try reading with an 8-bit addr len to discover actual addr len */
> e100_eeprom_read(nic, &addr_len, 0);
> - nic->eeprom_wc = 1 << addr_len;
> +
> + if (!addr_len || addr_len > 8) {
[Severity: High]
Can an addr_len that this check accepts still cause a shift-out-of-bounds?
addr_len starts at 8 and only decreases, so addr_len > 8 can never be
true, and values 1 to 7 are accepted.
Suppose EEDO first reads 0 at i == 23 during the discovery read. Then
len = 7, the new len > *addr_len guard in e100_eeprom_read() does not
fire, and addr_len becomes 1. eeprom_wc is then BIT(1) = 2.
A later ethtool -E with offset 0 and len 1 then goes:
e100_set_eeprom()
e100_eeprom_save(nic, 0, 1)
start + count >= eeprom_wc /* 1 >= 2, false */
e100_eeprom_write(nic, 1, ...)
and e100_eeprom_write() does:
cmd_addr_data[0] = op_ewen << (addr_len - 2);
...
cmd_addr_data[2] = op_ewds << (addr_len - 2);
After integer promotion, that is a shift by -1. On x86 the masked shift
also turns EWEN into an EWDS-like frame and sends no EWDS frame at all.
The write then fails silently while e100_eeprom_save() returns 0.
e100_eeprom_load() has the same check, so probe can succeed with
eeprom_wc == 2. That happens if the 2-word checksum matches or if
eeprom_bad_csum_allow=1 is set.
8255x Microwire EEPROMs use only 6 or 8 address bits. Should both checks
require addr_len to be 6 or 8, or at least addr_len >= 2?
> + netif_err(nic, probe, nic->netdev,
> + "Invalid EEPROM address length %u\n",
> + addr_len);
[Severity: Low]
This isn't a bug, but e100_eeprom_save() is only called from the ethtool
callback e100_set_eeprom(), never from probe. Should this use the hw or
drv message class instead of probe? With probe, the error is hidden when
probe messages are disabled.
> + return -EIO;
[Severity: Low]
This is a pre-existing issue and was not introduced by this patch.
e100_set_eeprom() copies the user data into the cache before it calls
e100_eeprom_save():
memcpy(&((u8 *)nic->eeprom)[eeprom->offset], bytes, eeprom->len);
return e100_eeprom_save(nic, eeprom->offset >> 1,
(eeprom->len >> 1) + 1);
If e100_eeprom_save() fails early, the cache keeps the rejected bytes.
That covers this new -EIO and the existing -EINVAL. e100_get_eeprom() then
reports those bytes as EEPROM contents.
Before this patch, an invalid addr_len took the -EINVAL path with the same
result, so this patch does not make it any worse. Should the cache change
be rolled back when e100_eeprom_save() fails?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203005042.348952-1-anthony.l.nguyen%40intel.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next 0/4][pull request] Intel Wired LAN Driver Updates 2026-12-02 (igc, igb, e100)
2026-12-03 0:50 [PATCH net-next 0/4][pull request] Intel Wired LAN Driver Updates 2026-12-02 (igc, igb, e100) Tony Nguyen
` (3 preceding siblings ...)
2026-12-03 0:50 ` [PATCH net-next 4/4] e100: prevent shift-out-of-bounds in EEPROM access Tony Nguyen
@ 2026-12-03 0:53 ` netdev-bot+sinfo
4 siblings, 0 replies; 11+ messages in thread
From: netdev-bot+sinfo @ 2026-12-03 0:53 UTC (permalink / raw)
To: Tony Nguyen
Cc: davem, kuba, pabeni, edumazet, andrew+netdev, willemb, netdev,
dima.ruinskiy, paweldembicki, pavankumaryalagada
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- What hardware the change was tested on. For driver fixes please
mention the device (and if relevant firmware version) used for
testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 11+ messages in thread