From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Ananyev Subject: [PATCH v5 06/10] examples/ipsec-secgw: fix inbound SA checking Date: Fri, 28 Dec 2018 15:33:54 +0000 Message-ID: <1546011238-22318-7-git-send-email-konstantin.ananyev@intel.com> References: <1544805623-18150-2-git-send-email-konstantin.ananyev@intel.com> Cc: akhil.goyal@nxp.com, Konstantin Ananyev , stable@dpdk.org, Bernard Iremonger Return-path: To: dev@dpdk.org In-Reply-To: <1544805623-18150-2-git-send-email-konstantin.ananyev@intel.com> To: dev@dpdk.org List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Radu Nicolau Signed-off-by: Konstantin Ananyev --- 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