From: Akhil Goyal <akhil.goyal@nxp.com>
To: Konstantin Ananyev <konstantin.ananyev@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 2/3] examples/ipsec_secgw: fix possible NULL dereference
Date: Wed, 27 Mar 2019 12:54:59 +0000 [thread overview]
Message-ID: <c62f7772-61db-e113-9a43-c8c21db0d198@nxp.com> (raw)
Message-ID: <20190327125459.ovIKNwciTCJ0ZzoTkxNHSeRfbZ8Xb8e-54nCbUFCKN4@z> (raw)
In-Reply-To: <20190327093329.12521-3-konstantin.ananyev@intel.com>
Hi Konstantin,
On 3/27/2019 3:03 PM, Konstantin Ananyev wrote:
> 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;
I think this is not fixing the NULL dereference properly. This line
would give fault if sa is null.
> - 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().
next prev parent reply other threads:[~2019-03-27 12:55 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 ` [dpdk-dev] [PATCH 2/3] examples/ipsec_secgw: fix possible NULL dereference Konstantin Ananyev
2019-03-27 9:33 ` Konstantin Ananyev
2019-03-27 12:54 ` Akhil Goyal [this message]
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=c62f7772-61db-e113-9a43-c8c21db0d198@nxp.com \
--to=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@intel.com \
/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).