cryptodev: fix cryptodev parameter parsing

Message ID 1602186134-591-1-git-send-email-haggaie@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series cryptodev: fix cryptodev parameter parsing |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Haggai Eran Oct. 8, 2020, 7:42 p.m. UTC
  The rte_cryptodev_pmd_parse_input_args function crashes with a
segmentation fault when passing a non-empty argument string.

The function passes cryptodev_pmd_valid_params to rte_kvargs_parse,
which accepts a NULL-terminated list of valid keys, yet
cryptodev_pmd_valid_params does not end with NULL. The patch adds the
missing NULL pointer.

Fixes: 9e6edea41805 ("cryptodev: add APIs to assist PMD initialisation")
Cc: stable@dpdk.org

Signed-off-by: Haggai Eran <haggaie@nvidia.com>
---
 lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Akhil Goyal Oct. 9, 2020, 5:51 p.m. UTC | #1
> The rte_cryptodev_pmd_parse_input_args function crashes with a
> segmentation fault when passing a non-empty argument string.
> 
> The function passes cryptodev_pmd_valid_params to rte_kvargs_parse,
> which accepts a NULL-terminated list of valid keys, yet
> cryptodev_pmd_valid_params does not end with NULL. The patch adds the
> missing NULL pointer.
> 
> Fixes: 9e6edea41805 ("cryptodev: add APIs to assist PMD initialisation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Haggai Eran <haggaie@nvidia.com>
> ---
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>

Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 81975d72b47a..1367222f7350 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -41,7 +41,8 @@ 
 static const char * const cryptodev_pmd_valid_params[] = {
 	RTE_CRYPTODEV_PMD_NAME_ARG,
 	RTE_CRYPTODEV_PMD_MAX_NB_QP_ARG,
-	RTE_CRYPTODEV_PMD_SOCKET_ID_ARG
+	RTE_CRYPTODEV_PMD_SOCKET_ID_ARG,
+	NULL
 };
 
 /**