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/2026…%40intel.com