public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Lifshits, Vitaly" <vitaly.lifshits@intel.com>
To: Kohei Enju <kohei@enjuk.jp>, <intel-wired-lan@lists.osuosl.org>,
	<netdev@vger.kernel.org>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>, <kohei.enju@gmail.com>
Subject: Re: [PATCH v1 iwl-net] igc: fix null pointer dereference in igc_eeprom_test() on NVM-less devices
Date: Thu, 5 Feb 2026 11:16:50 +0200	[thread overview]
Message-ID: <caf4b292-5fd0-4ced-bfbb-1ea4b99dca24@intel.com> (raw)
In-Reply-To: <20260205085030.60080-1-kohei@enjuk.jp>



On 2/5/2026 10:50 AM, Kohei Enju wrote:
> On devices without NVM, hw->nvm.ops.validate is set to NULL, therefore
> functions that perform EEPROM-related operations such as
> igc_ethtool_set_eeprom() and igc_probe() check for NVM presence in
> advance. However igc_eeprom_test() unconditionally calls
> hw->nvm.ops.validate(), potentially causing a null pointer dereference.
> 
> NVM-less devices may not be common but possible, so add NULL check
> before calling hw->nvm.ops.validate().
> 
> Fixes: f026d8ca2904 ("igc: add support to eeprom, registers and link self-tests")
> Signed-off-by: Kohei Enju <kohei@enjuk.jp>
> ---
>   drivers/net/ethernet/intel/igc/igc_diag.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_diag.c b/drivers/net/ethernet/intel/igc/igc_diag.c
> index a43d7244ee70..973d26a5a6c9 100644
> --- a/drivers/net/ethernet/intel/igc/igc_diag.c
> +++ b/drivers/net/ethernet/intel/igc/igc_diag.c
> @@ -158,7 +158,7 @@ bool igc_eeprom_test(struct igc_adapter *adapter, u64 *data)
>   
>   	*data = 0;
>   
> -	if (hw->nvm.ops.validate(hw) != IGC_SUCCESS) {
> +	if (hw->nvm.ops.validate && hw->nvm.ops.validate(hw) != IGC_SUCCESS) {
>   		*data = 1;
>   		return false;
>   	}


Hi Kohei,

Thank you for your patch.

Since there are no NVM-less devices I suggest removing the flash-less 
code entirely from the init flow.

  reply	other threads:[~2026-02-05  9:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05  8:50 [PATCH v1 iwl-net] igc: fix null pointer dereference in igc_eeprom_test() on NVM-less devices Kohei Enju
2026-02-05  9:16 ` Lifshits, Vitaly [this message]
2026-02-05  9:26   ` [PATCH v1 iwl-net] igc: fix null pointer dereference in Kohei Enju
2026-02-05 10:16     ` Lifshits, Vitaly
2026-02-05 15:49       ` Kohei Enju

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=caf4b292-5fd0-4ced-bfbb-1ea4b99dca24@intel.com \
    --to=vitaly.lifshits@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kohei.enju@gmail.com \
    --cc=kohei@enjuk.jp \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.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