From: Ankur Dwivedi <adwivedi@marvell.com>
To: <dev@dpdk.org>
Cc: <akhil.goyal@nxp.com>, <anoobj@marvell.com>,
<ktejasree@marvell.com>, Ankur Dwivedi <adwivedi@marvell.com>
Subject: [dpdk-dev] [PATCH v2] crypto/octeontx2: fix null pointer dereferences
Date: Thu, 28 Jan 2021 10:46:53 +0530 [thread overview]
Message-ID: <20210128051653.20503-1-adwivedi@marvell.com> (raw)
In-Reply-To: <20210122133523.22507-1-adwivedi@marvell.com>
Coverity reports that pointers ip and ip6 may be dereferenced
with null value. This patch fixes this.
Coverity issue: 365549
Coverity issue: 365551
Fixes: 8f685ec2d545 ("crypto/octeontx2: support AES-CBC SHA1-HMAC")
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
v2:
* Fixed wrong fixes reference in commit message.
drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
index 89ed7cbd2..342f089df 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
@@ -208,10 +208,10 @@ crypto_sec_ipsec_outb_session_create(struct rte_cryptodev *crypto_dev,
struct otx2_ipsec_po_sa_ctl *ctl;
int cipher_key_len, auth_key_len;
struct otx2_ipsec_po_out_sa *sa;
- struct rte_ipv6_hdr *ip6 = NULL;
- struct rte_ipv4_hdr *ip = NULL;
struct otx2_sec_session *sess;
struct otx2_cpt_inst_s inst;
+ struct rte_ipv6_hdr *ip6;
+ struct rte_ipv4_hdr *ip;
int ret, ctx_len;
sess = get_sec_session_private_data(sec_sess);
@@ -282,6 +282,8 @@ crypto_sec_ipsec_outb_session_create(struct rte_cryptodev *crypto_dev,
sa->sha2.template.ip4);
ctx_len = RTE_ALIGN_CEIL(ctx_len, 8);
lp->ctx_len = ctx_len >> 3;
+ } else {
+ return -EINVAL;
}
ip->version_ihl = RTE_IPV4_VHL_DEF;
ip->next_proto_id = IPPROTO_ESP;
@@ -331,6 +333,8 @@ crypto_sec_ipsec_outb_session_create(struct rte_cryptodev *crypto_dev,
sa->sha2.template.ip6);
ctx_len = RTE_ALIGN_CEIL(ctx_len, 8);
lp->ctx_len = ctx_len >> 3;
+ } else {
+ return -EINVAL;
}
ip6->vtc_flow = rte_cpu_to_be_32(0x60000000 |
--
2.28.0
next prev parent reply other threads:[~2021-01-28 5:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-22 13:35 [dpdk-dev] [PATCH] " Ankur Dwivedi
2021-01-28 5:16 ` Ankur Dwivedi [this message]
2021-02-02 19:17 ` [dpdk-dev] [PATCH v2] " 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=20210128051653.20503-1-adwivedi@marvell.com \
--to=adwivedi@marvell.com \
--cc=akhil.goyal@nxp.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=ktejasree@marvell.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).