DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/iavf: fix null pointer dereference
@ 2022-01-25 14:23 Weiguo Li
  2022-01-26 13:52 ` Nicolau, Radu
  2022-01-28  8:50 ` Zhang, Qi Z
  0 siblings, 2 replies; 3+ messages in thread
From: Weiguo Li @ 2022-01-25 14:23 UTC (permalink / raw)
  To: jingjing.wu; +Cc: radu.nicolau, dev

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>
---
 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..ac67aa28f7 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


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

* Re: [PATCH] net/iavf: fix null pointer dereference
  2022-01-25 14:23 [PATCH] net/iavf: fix null pointer dereference Weiguo Li
@ 2022-01-26 13:52 ` Nicolau, Radu
  2022-01-28  8:50 ` Zhang, Qi Z
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolau, Radu @ 2022-01-26 13:52 UTC (permalink / raw)
  To: Weiguo Li, jingjing.wu; +Cc: dev


On 1/25/2022 2:23 PM, Weiguo Li wrote:
> 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>



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

* RE: [PATCH] net/iavf: fix null pointer dereference
  2022-01-25 14:23 [PATCH] net/iavf: fix null pointer dereference Weiguo Li
  2022-01-26 13:52 ` Nicolau, Radu
@ 2022-01-28  8:50 ` Zhang, Qi Z
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2022-01-28  8:50 UTC (permalink / raw)
  To: Weiguo Li, Wu, Jingjing; +Cc: Nicolau, Radu, dev



> -----Original Message-----
> From: Weiguo Li <liwg06@foxmail.com>
> Sent: Tuesday, January 25, 2022 10:23 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: Nicolau, Radu <radu.nicolau@intel.com>; dev@dpdk.org
> Subject: [PATCH] net/iavf: fix null pointer dereference
> 
> 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>
> ---
>  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..ac67aa28f7 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);

Better to unwrap the bracket to keep coding style consistent 

>  	capabilities[number_of_capabilities].op =
> RTE_CRYPTO_OP_TYPE_UNDEFINED;
> 
>  	/**
> --
> 2.25.1


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

end of thread, other threads:[~2022-01-28  8:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 14:23 [PATCH] net/iavf: fix null pointer dereference Weiguo Li
2022-01-26 13:52 ` Nicolau, Radu
2022-01-28  8:50 ` Zhang, Qi Z

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).