[4/5] net/ring: fix segment fault when parse devargs
Checks
Commit Message
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(+)
@@ -562,6 +562,9 @@ static int parse_kvlist(const char *key __rte_unused,
char *node;
char *end;
+ if (value == NULL || data == 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) {