From: Radu Nicolau <radu.nicolau@intel.com>
To: Jingjing Wu <jingjing.wu@intel.com>, Beilei Xing <beilei.xing@intel.com>
Cc: dev@dpdk.org, Radu Nicolau <radu.nicolau@intel.com>, stable@dpdk.org
Subject: [PATCH] net/iavf: fix SPI check
Date: Fri, 14 Oct 2022 10:51:24 +0100 [thread overview]
Message-ID: <20221014095124.3580200-1-radu.nicolau@intel.com> (raw)
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(-)
diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c
index afd7f8f467..4c5c403a46 100644
--- a/drivers/net/iavf/iavf_ipsec_crypto.c
+++ b/drivers/net/iavf/iavf_ipsec_crypto.c
@@ -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;
}
/**
--
2.25.1
next reply other threads:[~2022-10-14 9:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-14 9:51 Radu Nicolau [this message]
2022-10-18 4:01 ` Zhang, Qi Z
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221014095124.3580200-1-radu.nicolau@intel.com \
--to=radu.nicolau@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).