1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/ethernet/intel/i40e
Michal Schmidt fc6f716a50 i40e: prevent crash on probe if hw registers have invalid values
The hardware provides the indexes of the first and the last available
queue and VF. From the indexes, the driver calculates the numbers of
queues and VFs. In theory, a faulty device might say the last index is
smaller than the first index. In that case, the driver's calculation
would underflow, it would attempt to write to non-existent registers
outside of the ioremapped range and crash.

I ran into this not by having a faulty device, but by an operator error.
I accidentally ran a QE test meant for i40e devices on an ice device.
The test used 'echo i40e > /sys/...ice PCI device.../driver_override',
bound the driver to the device and crashed in one of the wr32 calls in
i40e_clear_hw.

Add checks to prevent underflows in the calculations of num_queues and
num_vfs. With this fix, the wrong device probing reports errors and
returns a failure without crashing.

Fixes: 838d41d92a ("i40e: clear all queues and interrupts")
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Link: https://lore.kernel.org/r/20231011233334.336092-2-jacob.e.keller@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-10-13 17:57:05 -07:00
..
i40e.h i40e: Remove unnecessary aer.h include 2023-03-08 23:34:39 -08:00
i40e_adminq.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_adminq.h i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_adminq_cmd.h i40e: allow toggling loopback mode via ndo_set_features callback 2022-12-12 15:24:47 -08:00
i40e_alloc.h i40e: use int for i40e_status 2023-02-09 08:35:53 -08:00
i40e_client.c i40e: use ERR_PTR error print in i40e messages 2023-02-09 08:35:53 -08:00
i40e_common.c i40e: prevent crash on probe if hw registers have invalid values 2023-10-13 17:57:05 -07:00
i40e_dcb.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_dcb.h i40e: use int for i40e_status 2023-02-09 08:35:53 -08:00
i40e_dcb_nl.c i40e: use ERR_PTR error print in i40e messages 2023-02-09 08:35:53 -08:00
i40e_ddp.c i40e: Replace one-element array with flex-array member in struct i40e_package_header 2023-08-10 07:32:41 -07:00
i40e_debugfs.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_devids.h i40e: Add basic support for I710 devices 2022-09-06 12:49:00 -07:00
i40e_diag.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_diag.h i40e: fix registers dump after run ethtool adapter self test 2023-03-29 21:47:31 -07:00
i40e_ethtool.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_hmc.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_hmc.h i40e: use int for i40e_status 2023-02-09 08:35:53 -08:00
i40e_lan_hmc.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_lan_hmc.h i40e: use int for i40e_status 2023-02-09 08:35:53 -08:00
i40e_main.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-08-24 10:51:39 -07:00
i40e_nvm.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-08-18 12:44:56 -07:00
i40e_osdep.h i40e: use int for i40e_status 2023-02-09 08:35:53 -08:00
i40e_prototype.h i40e: Remove unused function declarations 2023-08-08 14:56:12 -07:00
i40e_ptp.c i40e: remove i40e_status 2023-07-31 14:37:25 -07:00
i40e_register.h i40e: Fix dropped jumbo frames statistics 2022-06-30 13:09:00 -07:00
i40e_trace.h i40e: add xdp_buff to i40e_ring struct 2023-03-09 13:11:24 -08:00
i40e_txrx.c i40e: xsk: add RX multi-buffer support 2023-07-19 09:56:50 -07:00
i40e_txrx.h i40e: xsk: add RX multi-buffer support 2023-07-19 09:56:50 -07:00
i40e_txrx_common.h i40e, xsk: Terminate Rx side of NAPI when XSK Rx queue gets full 2022-04-15 21:10:41 +02:00
i40e_type.h i40e: Replace one-element array with flex-array member in struct i40e_profile_aq_section 2023-08-10 10:41:54 -07:00
i40e_virtchnl_pf.c i40e: Fix VF VLAN offloading when port VLAN is configured 2023-09-15 09:15:16 -07:00
i40e_virtchnl_pf.h virtchnl: i40e/iavf: rename iwarp to rdma 2023-01-25 08:55:19 -08:00
i40e_xsk.c i40e: xsk: add TX multi-buffer support 2023-07-19 09:56:50 -07:00
i40e_xsk.h i40e: Fix DMA mappings leak 2022-10-14 08:24:31 +01:00
Makefile i40e: Implement DDP support in i40e driver 2019-04-16 15:10:21 -07:00