E610 does not support EEPROM writes and leaves eeprom.ops.write_buffer
as NULL. ixgbe_set_eeprom() calls this pointer without checking it,
causing a NULL pointer dereference when a set-eeprom request is issued
on an E610 port.

Check the op for NULL and return -ENOTSUP instead.

Fixes: 316637762a5f ("net/ixgbe/base: enable E610 device")
Cc: [email protected]

Signed-off-by: Sandeep Penigalapati <[email protected]>
---
v2:
 - Moved the NULL check before the argument validation so an
   unsupported request returns -ENOTSUP instead of -EINVAL.

 drivers/net/intel/ixgbe/ixgbe_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c 
b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index 78e19f94c0..b7b2b92e3c 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -7362,6 +7362,9 @@ ixgbe_set_eeprom(struct rte_eth_dev *dev,
        if (rte_eal_process_type() != RTE_PROC_PRIMARY)
                return -E_RTE_SECONDARY;
 
+       if (eeprom->ops.write_buffer == NULL)
+               return -ENOTSUP;
+
        first = in_eeprom->offset >> 1;
        length = in_eeprom->length >> 1;
        if ((first > hw->eeprom.word_size) ||
-- 
2.27.0

Reply via email to