DPDK patches and discussions
 help / color / mirror / Atom feed
From: Weiguo Li <liwg06@foxmail.com>
To: jingjing.wu@intel.com
Cc: radu.nicolau@intel.com, dev@dpdk.org
Subject: [PATCH v2] net/iavf: fix null pointer dereference
Date: Fri, 28 Jan 2022 17:43:15 +0800	[thread overview]
Message-ID: <tencent_5B7CA44A642FA69307EA342FA25627E39B05@qq.com> (raw)

Check for memory allocation failure is added to avoid null
pointer dereference.

Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto")

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
---
v2:
* Update to keep coding style consistent
---
 drivers/net/iavf/iavf_ipsec_crypto.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c
index adf101ab8a..6ac1b213db 100644
--- a/drivers/net/iavf/iavf_ipsec_crypto.c
+++ b/drivers/net/iavf/iavf_ipsec_crypto.c
@@ -1352,6 +1352,8 @@ iavf_ipsec_crypto_set_security_capabililites(struct iavf_security_ctx
 	capabilities = rte_zmalloc("crypto_cap",
 		sizeof(struct rte_cryptodev_capabilities) *
 		(number_of_capabilities + 1), 0);
+	if (!capabilities)
+		return -ENOMEM;
 	capabilities[number_of_capabilities].op = RTE_CRYPTO_OP_TYPE_UNDEFINED;
 
 	/**
-- 
2.25.1


             reply	other threads:[~2022-01-28  9:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28  9:43 Weiguo Li [this message]
2022-02-09  1:37 ` Zhang, Qi Z

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=tencent_5B7CA44A642FA69307EA342FA25627E39B05@qq.com \
    --to=liwg06@foxmail.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=radu.nicolau@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).