patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com,
	Konstantin Ananyev <konstantin.ananyev@intel.com>,
	stable@dpdk.org, Bernard Iremonger <bernard.iremonger@intel.com>
Subject: [dpdk-stable] [PATCH v6 06/10] examples/ipsec-secgw: fix inbound SA checking
Date: Thu,  3 Jan 2019 20:25:34 +0000	[thread overview]
Message-ID: <1546547138-24965-7-git-send-email-konstantin.ananyev@intel.com> (raw)
In-Reply-To: <1546011238-22318-2-git-send-email-konstantin.ananyev@intel.com>

In the inbound_sa_check() make sure that sa pointer stored
inside mbuf private area is not NULL.

Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application")
Cc: stable@dpdk.org

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 examples/ipsec-secgw/sa.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index f6271bc60..839aaca0c 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -947,10 +947,15 @@ int
 inbound_sa_check(struct sa_ctx *sa_ctx, struct rte_mbuf *m, uint32_t sa_idx)
 {
 	struct ipsec_mbuf_metadata *priv;
+	struct ipsec_sa *sa;
 
 	priv = get_priv(m);
+	sa = priv->sa;
+	if (sa != NULL)
+		return (sa_ctx->sa[sa_idx].spi == sa->spi);
 
-	return (sa_ctx->sa[sa_idx].spi == priv->sa->spi);
+	RTE_LOG(ERR, IPSEC, "SA not saved in private data\n");
+	return 0;
 }
 
 static inline void
-- 
2.17.1

      parent reply	other threads:[~2019-01-03 20:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1546011238-22318-2-git-send-email-konstantin.ananyev@intel.com>
2019-01-03 20:25 ` [dpdk-stable] [PATCH v6 03/10] examples/ipsec-secgw: fix crypto-op might never get dequeued Konstantin Ananyev
2019-01-03 20:25 ` [dpdk-stable] [PATCH v6 04/10] examples/ipsec-secgw: fix outbound codepath for single SA Konstantin Ananyev
2019-01-03 20:25 ` [dpdk-stable] [PATCH v6 05/10] examples/ipsec-secgw: make local variables static Konstantin Ananyev
2019-01-03 20:25 ` Konstantin Ananyev [this message]

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=1546547138-24965-7-git-send-email-konstantin.ananyev@intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --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).