Skip to contentSkip to conversation

net/iavf: fix SPI check

PATCH Applied Radu Nicolau 2 participants 2 messages Oct 14, 2022 – Oct 18, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/iavf: fix SPI check

Return error if SPI from the flow spec doesn't match the one from the crypto session.

Fixes 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
---
 drivers/net/iavf/iavf_ipsec_crypto.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/iavf/iavf_ipsec_crypto.c +3 -11
index afd7f8f467..4c5c403a46 100644
@@ -697,19 +697,11 @@ iavf_ipsec_crypto_action_valid(struct rte_eth_dev *ethdev,
 	if (unlikely(sess == NULL || sess->adapter != adapter))
 		return false;
 
-	/* SPI value must be non-zero */
-	if (spi == 0)
+	/* SPI value must be non-zero and must match flow SPI*/
+	if (spi == 0 || (htonl(sess->sa.spi) != spi))
 		return false;
-	/* Session SPI must patch flow SPI*/
-	else if (sess->sa.spi == spi) {
-		return true;
-		/**
-		 * TODO: We should add a way of tracking valid hw SA indices to
-		 * make validation less brittle
-		 */
-	}
 
-		return true;
+	return true;
 }
 
 /**
Signature · 1 line
2.25.1
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Radu Nicolau <[email protected]>
Sent: Friday, October 14, 2022 5:51 PM
To: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Nicolau, Radu <[email protected]>; [email protected]
Subject: [PATCH] net/iavf: fix SPI check

Quoted 7 lines

Return error if SPI from the flow spec doesn't match the one from the crypto session.

Fixes 6bc987ecb860 ("net/iavf: support IPsec inline crypto")

Applied to dpdk-next-net-intel.

Thanks
Qi