From: Konstantin Ananyev Date: Thu, 10 Jan 2019 21:09:09 +0000 (+0000) Subject: examples/ipsec-secgw: fix inbound SA checking X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e0dac065f2a232e8060c479a094c7f58cfc93cf9;p=dpdk.git examples/ipsec-secgw: fix inbound SA checking 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 Acked-by: Akhil Goyal Signed-off-by: Konstantin Ananyev --- diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index f6271bc60a..839aaca0c3 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