crypto/ipsec_mb: fix null pointer dereference

Message ID tencent_7E11AE18371EF353FD88339DCBEFB7113C07@qq.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series crypto/ipsec_mb: fix null pointer dereference |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Weiguo Li Jan. 29, 2022, 4:30 p.m. UTC
  Adjust memory check and use in a proper order to avoid
null pointer dereference.

Fixes: 918fd2f1466b ("crypto/ipsec_mb: move aesni_mb PMD")

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 drivers/crypto/ipsec_mb/ipsec_mb_private.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Akhil Goyal Feb. 8, 2022, 9:44 p.m. UTC | #1
> Adjust memory check and use in a proper order to avoid
> null pointer dereference.
> 
> Fixes: 918fd2f1466b ("crypto/ipsec_mb: move aesni_mb PMD")
> 
> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
> ---
This patch is a duplicate of a patch already submitted.
http://patches.dpdk.org/project/dpdk/patch/20220116194043.1388372-1-piotrx.bronowski@intel.com/
  

Patch

diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
index 866722d6f4..cae8f68988 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h
@@ -191,12 +191,11 @@  ipsec_mb_parse_xform(const struct rte_crypto_sym_xform *xform,
 			const struct rte_crypto_sym_xform **cipher_xform,
 			const struct rte_crypto_sym_xform **aead_xform)
 {
-	const struct rte_crypto_sym_xform *next = xform->next;
-
 	if (xform == NULL) {
 		*mode = IPSEC_MB_OP_NOT_SUPPORTED;
 		return -ENOTSUP;
 	}
+	const struct rte_crypto_sym_xform *next = xform->next;
 
 	if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER) {
 		if (next == NULL) {