mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: syzbot <syzbot+e0abb1d45ac291ebebeb@syzkaller.appspotmail.com>
To: pavankumaryalagada@gmail.com
Cc: pavankumaryalagada@gmail.com, syzkaller-bugs@googlegroups.com,
	 linux-kernel@vger.kernel.org
Subject: Re: [Intel-wired-lan] [syzbot] [intel-wired-lan?] UBSAN: shift-out-of-bounds in e100_eeprom_load
Date: Fri, 04 Dec 2026 05:25:18 -0800	[thread overview]
Message-ID: <6b12bf3e.22b41460.29d412.0209.GAE@google.com> (raw)
In-Reply-To: <axK_IVn7NOPkxesm@user>

> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

Patch testing via #syz test is temporarily disabled.
See https://github.com/google/syzkaller/issues/8122 for details.

>
> 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;

           reply	other threads:[~2026-12-04 13:25 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <axK_IVn7NOPkxesm@user>]

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=6b12bf3e.22b41460.29d412.0209.GAE@google.com \
    --to=syzbot+e0abb1d45ac291ebebeb@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavankumaryalagada@gmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /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

all inboxes | Powered by JetHome®