From: netdev-bot+sashiko@kernel.org
To: anthony.l.nguyen@intel.com
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@kernel.org, andrew+netdev@lunn.ch,
netdev@vger.kernel.org, florian.bezdeka@siemens.com,
meng.ding@siemens.com, p@1g4.org, tkusters@aweta.nl,
jiayuan.chen@linux.dev, pulehui@huawei.com,
dima.ruinskiy@intel.com, raanan.avargil@intel.com,
gil.fine@intel.com, stable@vger.kernel.org,
javier.herrera@afronta.com, aleksandr.loktionov@intel.com
Subject: Re: [PATCH net 5/6] e1000e: Fix out-of-bounds MMIO access by validating BAR0 size
Date: Mon, 05 Oct 2026 23:02:45 +0000 [thread overview]
Message-ID: <179124136574.434549.6280763039812570100@kernel.org> (raw)
In-Reply-To: <20261001222443.3500206-6-anthony.l.nguyen@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
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 patch checks the size of BAR0 only.
--
e1000e: Fix out-of-bounds MMIO access by validating BAR0 size
This commit makes e1000_probe() reject devices whose BAR0 is smaller than
SZ_64K, before ioremap() is called. It fixes a syzkaller-reported oops.
In that report a foreign device with a 4K BAR0 was bound through new_id,
and probe read EEMNGCTL past the end of the mapping.
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 746a395869998..ad9b88c9af225 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -7455,6 +7455,12 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> mmio_len = pci_resource_len(pdev, 0);
>
> err = -EIO;
> + /* Smallest BAR0 that covers every register the driver accesses */
> + if (mmio_len < SZ_64K) {
> + dev_err(&pdev->dev, "MMIO len is too small\n");
> + goto err_ioremap;
> + }
> +
> adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
> if (!adapter->hw.hw_addr)
> goto err_ioremap;
[Severity: Medium]
Does this check also cover the flash registers on ICH/PCH parts older
than SPT?
The commit message says:
This accounts not only for standard registers up to E1000_SYSSTMPH,
but also for flash registers mapped on ICH/PCH chipsets (up to offset
0xE074 / ~57.1 KB). Since PCI BAR sizes are power-of-two aligned,
SZ_64K is the minimum valid BAR0 size required to ensure all
subsequent MMIO accesses remain strictly within the mapped boundary.
That seems true only for e1000_pch_spt and later. On those parts,
e1000_init_nvm_params_ich8lan() puts the flash registers inside BAR0:
hw->flash_address = hw->hw_addr + E1000_FLASH_BASE_ADDR;
On ICH8/9/10, PCH, PCH2 and PCH_LPT the flash registers are in BAR1.
e1000_probe() maps BAR1 right after this hunk, with no minimum length:
if ((adapter->flags & FLAG_HAS_FLASH) &&
(pci_resource_flags(pdev, 1) & IORESOURCE_MEM) &&
(hw->mac.type < e1000_pch_spt)) {
flash_start = pci_resource_start(pdev, 1);
flash_len = pci_resource_len(pdev, 1);
adapter->hw.flash_address = ioremap(flash_start, flash_len);
Probe then reads and writes fixed offsets in that mapping. The second
step runs because FLAG_READ_ONLY_NVM is on by default for ICH parts:
e1000_probe()
ei->get_variants()
e1000_init_nvm_params_ich8lan()
er32flash(ICH_FLASH_GFPREG) /* 0x0 */
e1000e_write_protect_nvm_ich8lan()
er32flash(ICH_FLASH_PR0) /* 0x74 */
ew32flash(ICH_FLASH_PR0, pr0.regval)
er16flash(ICH_FLASH_HSFSTS)
ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval)
new_id_store() accepts a 7-field new_id. The driver_data can match any
existing table entry, such as board_ich8lan, board_pchlan or
board_pch_lpt. So the reproducer from the commit message can still be
used against a foreign device that has:
- a BAR0 of at least 64K, which passes the new check
- a memory BAR1 smaller than 0x78 bytes (PCI allows memory BARs as
small as 16 bytes)
Would the PR0 read-modify-write at offset 0x74 then go past the end of
the BAR1 mapping? If the small BAR sits at the end of a page, this
could fault like the EEMNGCTL oops. Otherwise it could read and write
registers of whatever device decodes the next addresses.
The later "e1000e: add system to disable K1 list" patch in this series
does not appear to change this path.
Would BAR1 need its own minimum size check for the commit message's
claim to hold? That could be at least ICH_FLASH_PR0 + 4, or SZ_4K to
match real hardware.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261001222443.3500206-1-anthony.l.nguyen%40intel.com
next prev parent reply other threads:[~2026-10-05 23:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 22:24 [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2026-10-01 (igc, igb, e1000e) Tony Nguyen
2026-10-01 22:24 ` [PATCH net 1/6] igc: Fix RX HW timestamp reporting when NET_RX_BUSY_POLL is disabled Tony Nguyen
2026-10-05 23:02 ` netdev-bot+sashiko
2026-10-08 1:57 ` Jakub Kicinski
2026-10-01 22:24 ` [PATCH net 2/6] igc: only strip RX timestamp header from first buffer Tony Nguyen
2026-10-05 23:02 ` netdev-bot+sashiko
2026-10-07 16:02 ` Paul Moses
2026-10-01 22:24 ` [PATCH net 3/6] igb: only strip Rx timestamp header on the first buffer of a frame Tony Nguyen
2026-10-05 23:02 ` netdev-bot+sashiko
2026-10-01 22:24 ` [PATCH net 4/6] e1000e: fix IRQ leak when request_irq() fails in e1000_request_msix() Tony Nguyen
2026-10-01 22:24 ` [PATCH net 5/6] e1000e: Fix out-of-bounds MMIO access by validating BAR0 size Tony Nguyen
2026-10-05 23:02 ` netdev-bot+sashiko [this message]
2026-10-01 22:24 ` [PATCH net 6/6] e1000e: add system to disable K1 list Tony Nguyen
2026-10-01 22:29 ` [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2026-10-01 (igc, igb, e1000e) netdev-bot+sinfo
2026-10-08 2:02 ` Jakub Kicinski
2026-10-08 17:04 ` Tony Nguyen
2026-10-08 2:10 ` patchwork-bot+netdevbpf
2026-10-08 2:10 ` patchwork-bot+netdevbpf
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=179124136574.434549.6280763039812570100@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=dima.ruinskiy@intel.com \
--cc=edumazet@kernel.org \
--cc=florian.bezdeka@siemens.com \
--cc=gil.fine@intel.com \
--cc=javier.herrera@afronta.com \
--cc=jiayuan.chen@linux.dev \
--cc=kuba@kernel.org \
--cc=meng.ding@siemens.com \
--cc=netdev@vger.kernel.org \
--cc=p@1g4.org \
--cc=pabeni@redhat.com \
--cc=pulehui@huawei.com \
--cc=raanan.avargil@intel.com \
--cc=stable@vger.kernel.org \
--cc=tkusters@aweta.nl \
/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