public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 iwl-net] igc: fix null pointer dereference in igc_eeprom_test() on NVM-less devices
@ 2026-02-05  8:50 Kohei Enju
  2026-02-05  9:16 ` Lifshits, Vitaly
  0 siblings, 1 reply; 5+ messages in thread
From: Kohei Enju @ 2026-02-05  8:50 UTC (permalink / raw)
  To: intel-wired-lan, netdev
  Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Vitaly Lifshits,
	kohei.enju, Kohei Enju

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-05 15:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox