Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | success | coding style OK |
Commit Message
fengchengwen
March 20, 2023, 9:20 a.m. UTC
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 61934c0956d4 ("ring: convert to use of PMD_REGISTER_DRIVER and fix linking")
Fixes: 96cb19521147 ("net/ring: use EAL APIs in PMD specific API")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/ring/rte_eth_ring.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index e8bc9b6271..88b19e205e 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -562,6 +562,9 @@ static int parse_kvlist(const char *key __rte_unused, char *node; char *end; + if (value == NULL) + return -EINVAL; + name = strdup(value); ret = -EINVAL; @@ -630,6 +633,9 @@ parse_internal_args(const char *key __rte_unused, const char *value, void *args; int ret, n; + if (value == NULL) + return -EINVAL; + /* make sure 'value' is valid pointer length */ if (strnlen(value, ETH_RING_INTERNAL_ARG_MAX_LEN) >= ETH_RING_INTERNAL_ARG_MAX_LEN) {