* [PATCH iwl-next v5] e100: prevent shift-out-of-bounds in EEPROM access
@ 2026-12-06 14:40 pavankumaryalagada
2026-12-06 14:43 ` netdev-bot+sinfo
0 siblings, 1 reply; 2+ messages in thread
From: pavankumaryalagada @ 2026-12-06 14:40 UTC (permalink / raw)
To: anthony.l.nguyen, przemyslaw.kitszel
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, intel-wired-lan,
netdev, linux-kernel, syzbot+e0abb1d45ac291ebebeb, kohei,
aleksandr.loktionov, Yalagada Pavan Kumar
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.
Validate addr_len after reading it from the EEPROM in both
e100_eeprom_load() and e100_eeprom_save(), accepting only the supported
6-bit and 8-bit address lengths and returning -EIO otherwise. Also,
check that addr_len remains unchanged during EEPROM loading.
Reported-by: syzbot+e0abb1d45ac291ebebeb@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e0abb1d45ac291ebebeb
Signed-off-by: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>
---
v5:
- Validate addr_len against supported 6-bit and 8-bit EEPROM sizes.
- Check that addr_len remains unchanged during EEPROM loading.
- Address issues raised in Sashiko review.
v4:
- Squash the v1-v3 changes into a single standalone patch.
- Prevent addr_len underflow during EEPROM probing.
- Validate addr_len in e100_eeprom_load() and e100_eeprom_save().
- Use BIT() and cast the result to u16 for eeprom_wc.
- Target iwl-next as requested by Tony Nguyen.
v3: https://lore.kernel.org/all/20260816113754.22900-1-pavankumaryalagada@gmail.com/T/
v2: https://lore.kernel.org/all/20260810083355.21631-1-pavankumaryalagada@gmail.com/T/
v1: https://lore.kernel.org/all/20260807145626.52692-1-pavankumaryalagada@gmail.com/T/
---
drivers/net/ethernet/intel/e100.c | 44 +++++++++++++++++++++++++++----
1 file changed, 39 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index 29960762e64a..1f7578fa402f 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;
}
@@ -761,14 +768,33 @@ static __le16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
/* Load entire EEPROM image into driver cache and validate checksum */
static int e100_eeprom_load(struct nic *nic)
{
- u16 addr, addr_len = 8, checksum = 0;
+ u16 addr, addr_len = 8, eeprom_addr_len, checksum = 0;
/* 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 != 6 && addr_len != 8) {
+ netif_err(nic, probe, nic->netdev,
+ "Invalid EEPROM address length %u\n", addr_len);
+ return -EIO;
+ }
+
+ eeprom_addr_len = addr_len;
+ 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);
+ __le16 data;
+
+ data = e100_eeprom_read(nic, &addr_len, addr);
+
+ if (addr_len != eeprom_addr_len) {
+ netif_err(nic, probe, nic->netdev,
+ "Invalid EEPROM address length %u (expected %u)\n",
+ addr_len, eeprom_addr_len);
+ return -EIO;
+ }
+
+ nic->eeprom[addr] = data;
if (addr < nic->eeprom_wc - 1)
checksum += le16_to_cpu(nic->eeprom[addr]);
}
@@ -791,7 +817,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 != 6 && addr_len != 8) {
+ netif_err(nic, hw, 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.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH iwl-next v5] e100: prevent shift-out-of-bounds in EEPROM access
2026-12-06 14:40 [PATCH iwl-next v5] e100: prevent shift-out-of-bounds in EEPROM access pavankumaryalagada
@ 2026-12-06 14:43 ` netdev-bot+sinfo
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-12-06 14:43 UTC (permalink / raw)
To: pavankumaryalagada
Cc: anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev, davem,
edumazet, kuba, pabeni, intel-wired-lan, netdev, linux-kernel,
syzbot+e0abb1d45ac291ebebeb, kohei, aleksandr.loktionov
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] 2+ messages in thread
end of thread, other threads:[~2026-12-06 14:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-06 14:40 [PATCH iwl-next v5] e100: prevent shift-out-of-bounds in EEPROM access pavankumaryalagada
2026-12-06 14:43 ` netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®