DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] crypto/octeontx2: fix null pointer dereferences
@ 2021-01-22 13:35 Ankur Dwivedi
  2021-01-28  5:16 ` [dpdk-dev] [PATCH v2] " Ankur Dwivedi
  0 siblings, 1 reply; 3+ messages in thread
From: Ankur Dwivedi @ 2021-01-22 13:35 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, anoobj, ktejasree, Ankur Dwivedi

Coverity reports that pointers ip and ip6 may be dereferenced
with null value. This patch fixes this.

Coverity issue: 365549
Coverity issue: 365551

Fixes: 1c119d38876d ("crypto/octeontx2: support lookaside AES-CBC SHA1-HMAC")

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 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 89ed7cbd25..342f089df8 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH v2] crypto/octeontx2: fix null pointer dereferences
  2021-01-22 13:35 [dpdk-dev] [PATCH] crypto/octeontx2: fix null pointer dereferences Ankur Dwivedi
@ 2021-01-28  5:16 ` Ankur Dwivedi
  2021-02-02 19:17   ` Akhil Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Ankur Dwivedi @ 2021-01-28  5:16 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, anoobj, ktejasree, Ankur Dwivedi

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v2] crypto/octeontx2: fix null pointer dereferences
  2021-01-28  5:16 ` [dpdk-dev] [PATCH v2] " Ankur Dwivedi
@ 2021-02-02 19:17   ` Akhil Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2021-02-02 19:17 UTC (permalink / raw)
  To: Ankur Dwivedi, dev; +Cc: anoobj, ktejasree

> 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.
Applied to dpdk-next-crypto

Thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-02 19:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 13:35 [dpdk-dev] [PATCH] crypto/octeontx2: fix null pointer dereferences Ankur Dwivedi
2021-01-28  5:16 ` [dpdk-dev] [PATCH v2] " Ankur Dwivedi
2021-02-02 19:17   ` Akhil Goyal

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git