[v2] net/iavf: fix null pointer dereference
Checks
Commit Message
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(+)
Comments
> -----Original Message-----
> From: Weiguo Li <liwg06@foxmail.com>
> Sent: Friday, January 28, 2022 5:43 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: Nicolau, Radu <radu.nicolau@intel.com>; dev@dpdk.org
> Subject: [PATCH v2] 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>
> Acked-by: Radu Nicolau <radu.nicolau@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
@@ -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;
/**