Skip to contentSkip to conversation

ixgbevf: off by one in ixgbevf_ipsec_tx()

PATCH In review Dan Carpenter 3 participants 3 messages Sep 19, 2018 – Sep 27, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixgbevf: off by one in ixgbevf_ipsec_tx()

The ipsec->tx_tbl[] array has IXGBE_IPSEC_MAX_SA_COUNT elements so the > should be a >=.

Fixes 0062e7cc955e ("ixgbevf: add VF IPsec offload code")
drivers/net/ethernet/intel/ixgbevf/ipsec.c +1 -1
index 997cea675a37..4fcbeffce52b 100644
@@ -470,7 +470,7 @@ int ixgbevf_ipsec_tx(struct ixgbevf_ring *tx_ring,
 	}
 
 	sa_idx = xs->xso.offload_handle - IXGBE_IPSEC_BASE_TX_INDEX;
-	if (unlikely(sa_idx > IXGBE_IPSEC_MAX_SA_COUNT)) {
+	if (unlikely(sa_idx >= IXGBE_IPSEC_MAX_SA_COUNT)) {
 		netdev_err(tx_ring->netdev, "%s: bad sa_idx=%d handle=%lu\n",
 			   __func__, sa_idx, xs->xso.offload_handle);
 		return 0;
#1 lore raw
Quoted 5 lines · Dan Carpenter

The ipsec->tx_tbl[] array has IXGBE_IPSEC_MAX_SA_COUNT elements so the > should be a >=.

Fixes 0062e7cc955e ("ixgbevf: add VF IPsec offload code")
Quoted 15 lines
drivers/net/ethernet/intel/ixgbevf/ipsec.c +1 -1
index 997cea675a37..4fcbeffce52b 100644
@@ -470,7 +470,7 @@ int ixgbevf_ipsec_tx(struct ixgbevf_ring *tx_ring,
  	}
 
  	sa_idx = xs->xso.offload_handle - IXGBE_IPSEC_BASE_TX_INDEX;
-	if (unlikely(sa_idx > IXGBE_IPSEC_MAX_SA_COUNT)) {
+	if (unlikely(sa_idx >= IXGBE_IPSEC_MAX_SA_COUNT)) {
  		netdev_err(tx_ring->netdev, "%s: bad sa_idx=%d handle=%lu\n",
  			   __func__, sa_idx, xs->xso.offload_handle);
  		return 0;
#2 lore raw

PATCH 1/1 ixgbevf: off by one in ixgbevf_ipsec_tx()

In reply to Dan Carpenter
Quoted 10 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Dan Carpenter
Sent: Wednesday, September 19, 2018 3:35 AM
To: Kirsher, Jeffrey T <[email protected]>; Shannon Nelson <[email protected]>
Cc: netdev at vger.kernel.org; kernel-janitors at vger.kernel.org; intel-wired- lan at lists.osuosl.org; David S. Miller <[email protected]>
Subject: [Intel-wired-lan] [PATCH] ixgbevf: off by one in ixgbevf_ipsec_tx()

Quoted 5 lines

The ipsec->tx_tbl[] array has IXGBE_IPSEC_MAX_SA_COUNT elements so the > should be a >=.

Fixes 0062e7cc955e ("ixgbevf: add VF IPsec offload code")