Checks
Commit Message
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")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
drivers/net/iavf/iavf_ipsec_crypto.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
Comments
> -----Original Message-----
> From: Radu Nicolau <radu.nicolau@intel.com>
> Sent: Friday, October 14, 2022 5:51 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Nicolau, Radu <radu.nicolau@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] 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")
> Cc: stable@dpdk.org
>
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
@@ -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;
}
/**