mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Menzel <pmenzel@molgen.mpg.de>
To: Mikael Wessel <post@mikaelkw.online>
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
	torvalds@linuxfoundation.org, anthony.l.nguyen@intel.com,
	przemyslaw.kitszel@intel.com, andrew@lunn.ch, kuba@kernel.org,
	pabeni@redhat.com, security@kernel.org, stable@vger.kernel.org,
	davem@davemloft.net, edumazet@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [Intel-wired-lan] [PATCH v2 1/1] e1000e: fix heap overflow in e1000_set_eeprom()
Date: Tue, 27 May 2025 16:43:22 +0200	[thread overview]
Message-ID: <7eed2cf1-5d54-4669-9e31-96707a116f01@molgen.mpg.de> (raw)
In-Reply-To: <20250527085612.11354-2-post@mikaelkw.online>

Dear Mikael,


Thank you for your patch.

Am 27.05.25 um 10:56 schrieb Mikael Wessel:
> The ETHTOOL_SETEEPROM ioctl copies user data into a kmalloc'ed buffer
> without validating eeprom->len and eeprom->offset.  A CAP_NET_ADMIN
> user can overflow the heap and crash the kernel or gain code execution.
> 
> Validate length and offset before memcpy().
> 
> Fixes: bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)")
> Reported-by: Mikael Wessel <post@mikaelkw.online>
> Signed-off-by: Mikael Wessel <post@mikaelkw.online>
> Cc: stable@vger.kernel.org
> ---
>   drivers/net/ethernet/intel/e1000e/ethtool.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
> index 9364bc2b4eb1..98e541e39730 100644
> --- a/drivers/net/ethernet/intel/e1000e/ethtool.c
> +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
> @@ -596,6 +596,9 @@ static int e1000_set_eeprom(struct net_device *netdev,
>   	for (i = 0; i < last_word - first_word + 1; i++)
>   		le16_to_cpus(&eeprom_buff[i]);
>   
> +        if (eeprom->len > max_len ||
> +            eeprom->offset > max_len - eeprom->len)
> +                return -EINVAL;

I think you used spaces instead of tabs for indentation. It’d be great 
if you could fix this, and send v3 tomorrow. Running 
`scripts/checkpatch.pl` with the patch as an argument, should catch 
these things.

>   	memcpy(ptr, bytes, eeprom->len);
>   
>   	for (i = 0; i < last_word - first_word + 1; i++)


Kind regards,

Paul

  parent reply	other threads:[~2025-05-27 14:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27  8:56 [PATCH v2 net 0/1] " Mikael Wessel
2025-05-27  8:56 ` [PATCH v2 1/1] " Mikael Wessel
2025-05-27 14:37   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-05-27 14:43   ` Paul Menzel [this message]
2025-05-27 14:45     ` Paul Menzel
2025-05-27 15:52   ` Tony Nguyen

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=7eed2cf1-5d54-4669-9e31-96707a116f01@molgen.mpg.de \
    --to=pmenzel@molgen.mpg.de \
    --cc=andrew@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=post@mikaelkw.online \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=security@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linuxfoundation.org \
    /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®