From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com, Konstantin Ananyev <konstantin.ananyev@intel.com>
Subject: [dpdk-dev] [PATCH 2/3] examples/ipsec_secgw: fix possible NULL dereference
Date: Wed, 27 Mar 2019 09:33:28 +0000 [thread overview]
Message-ID: <20190327093329.12521-3-konstantin.ananyev@intel.com> (raw)
Message-ID: <20190327093328.9WYyxVUEyDMBh7cbrKB7r7p6d3KgH3zV2huXtjD0wtU@z> (raw)
In-Reply-To: <20190327093329.12521-1-konstantin.ananyev@intel.com>
Fixes: 3e5f4625dc17 ("examples/ipsec-secgw: make data-path to use IPsec library")
Coverity issue: 336844
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
examples/ipsec-secgw/ipsec_process.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec_process.c b/examples/ipsec-secgw/ipsec_process.c
index e403c461a..3f9cacb8f 100644
--- a/examples/ipsec-secgw/ipsec_process.c
+++ b/examples/ipsec-secgw/ipsec_process.c
@@ -217,16 +217,11 @@ ipsec_process(struct ipsec_ctx *ctx, struct ipsec_traffic *trf)
pg = grp + i;
sa = pg->id.ptr;
- /* no valid SA found */
- if (sa == NULL)
- k = 0;
-
ips = &sa->ips;
- satp = rte_ipsec_sa_type(ips->sa);
/* no valid HW session for that SA, try to create one */
- if (ips->crypto.ses == NULL &&
- fill_ipsec_session(ips, ctx, sa) != 0)
+ if (sa == NULL || (ips->crypto.ses == NULL &&
+ fill_ipsec_session(ips, ctx, sa) != 0))
k = 0;
/* process packets inline */
@@ -234,6 +229,8 @@ ipsec_process(struct ipsec_ctx *ctx, struct ipsec_traffic *trf)
sa->type ==
RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) {
+ satp = rte_ipsec_sa_type(ips->sa);
+
/*
* This is just to satisfy inbound_sa_check()
* and get_hop_for_offload_pkt().
--
2.17.1
next prev parent reply other threads:[~2019-03-27 9:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-27 9:33 [dpdk-dev] [PATCH 0/3] few trivial fixes for ipsec-secgw Konstantin Ananyev
2019-03-27 9:33 ` Konstantin Ananyev
2019-03-27 9:33 ` [dpdk-dev] [PATCH 1/3] examples/ipsec-secgw: fix invalid out-of-bound check Konstantin Ananyev
2019-03-27 9:33 ` Konstantin Ananyev
2019-03-27 12:52 ` Akhil Goyal
2019-03-27 12:52 ` Akhil Goyal
2019-03-27 9:33 ` Konstantin Ananyev [this message]
2019-03-27 9:33 ` [dpdk-dev] [PATCH 2/3] examples/ipsec_secgw: fix possible NULL dereference Konstantin Ananyev
2019-03-27 12:54 ` Akhil Goyal
2019-03-27 12:54 ` Akhil Goyal
2019-03-27 13:19 ` Ananyev, Konstantin
2019-03-27 13:19 ` Ananyev, Konstantin
2019-03-27 14:37 ` Akhil Goyal
2019-03-27 14:37 ` Akhil Goyal
2019-03-27 9:33 ` [dpdk-dev] [PATCH 3/3] examples/ipsec-secgw: fix typo in test script Konstantin Ananyev
2019-03-27 9:33 ` Konstantin Ananyev
2019-03-27 12:55 ` Akhil Goyal
2019-03-27 12:55 ` Akhil Goyal
2019-03-29 14:21 ` [dpdk-dev] [PATCH 0/3] few trivial fixes for ipsec-secgw Akhil Goyal
2019-03-29 14:21 ` Akhil Goyal
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=20190327093329.12521-3-konstantin.ananyev@intel.com \
--to=konstantin.ananyev@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@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).