DPDK patches and discussions
 help / color / mirror / Atom feed
From: Akhil Goyal <akhil.goyal@nxp.com>
To: "Ananyev, Konstantin" <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 14:37:12 +0000	[thread overview]
Message-ID: <3af6131e-e614-e9d5-46e3-89cc5ac30e90@nxp.com> (raw)
Message-ID: <20190327143712.gV3XBy_YyS5UWUNJqcVGu9SfxDw7HABr9A6DKXE4hgs@z> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB9772580136560AC0@irsmsx105.ger.corp.intel.com>



On 3/27/2019 6:49 PM, Ananyev, Konstantin wrote:
> Hi Akhil,
>
>>> 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.
> I don't think it would - here we just get an address of ips,
> we don't try to access it.
> Konstantin
ok got it.. I missed the '&'..
>
>>> -		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().


  parent reply	other threads:[~2019-03-27 14:37 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
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 [this message]
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=3af6131e-e614-e9d5-46e3-89cc5ac30e90@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).