[PATCH v2 24/44] net/netvsc: fix segment fault when parse devargs

Long Li longli at microsoft.com
Tue Mar 21 23:20:25 CET 2023


> Subject: [PATCH v2 24/44] net/netvsc: fix segment fault when parse devargs
> 
> 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: a25d39a3eb69 ("net/netvsc: allow tuning latency with devargs")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>

Thank you.

Acked-by: Long Li <longli at microsoft.com>

> ---
>  drivers/net/netvsc/hn_ethdev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
> index d0bbc0a4c0..e13eb03176 100644
> --- a/drivers/net/netvsc/hn_ethdev.c
> +++ b/drivers/net/netvsc/hn_ethdev.c
> @@ -157,6 +157,9 @@ static int hn_set_parameter(const char *key, const
> char *value, void *opaque)
>  	char *endp = NULL;
>  	unsigned long v;
> 
> +	if (value == NULL)
> +		return -EINVAL;
> +
>  	v = strtoul(value, &endp, 0);
>  	if (*value == '\0' || *endp != '\0') {
>  		PMD_DRV_LOG(ERR, "invalid parameter %s=%s", key, value);
> --
> 2.17.1



More information about the dev mailing list