[dpdk-dev] [PATCH] net/i40e: fix VF reset stats crash

Van Haaren, Harry harry.van.haaren at intel.com
Thu Jan 11 15:51:26 CET 2018


> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of David C Harton
> Sent: Thursday, January 11, 2018 1:24 PM
> To: Wu, Jingjing <jingjing.wu at intel.com>; Xing, Beilei
> <beilei.xing at intel.com>
> Cc: dev at dpdk.org; David C Harton <dharton at cisco.com>; Zhao1, Wei
> <wei.zhao1 at intel.com>
> Subject: [dpdk-dev] [PATCH] net/i40e: fix VF reset stats crash
> 
> Calling i40evf_dev_xstats_reset can sometimes crash.
> 
> Fixed issue by adding a pstats NULL check.

Perhaps add a note here, that the root cause of (pstats == NULL)
is a valid error return from i40evf_query_stats(), if the vf
command fails to execute.

Hence, we are not hiding symptoms of a different issue here,
this NULL check is required to validate the returned values.


> Fixes: da61cd0849766 ("i40evf: add extended stats")
>        8210e9e0d805e ("net/i40e: fix clear xstats bug in VF")
> Cc: wei.zhao1 at intel.com
> 
> Signed-off-by: David C Harton <dharton at cisco.com>


Acked-by: Harry van Haaren <harry.van.haaren at intel.com>


> ---
>  drivers/net/i40e/i40e_ethdev_vf.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> b/drivers/net/i40e/i40e_ethdev_vf.c
> index b96d77a..9c773fe 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -923,7 +923,8 @@ i40evf_dev_xstats_reset(struct rte_eth_dev *dev)
>  	i40evf_query_stats(dev, &pstats);
> 
>  	/* set stats offset base on current values */
> -	vf->vsi.eth_stats_offset = *pstats;
> +	if (pstats != NULL)
> +		vf->vsi.eth_stats_offset = *pstats;
>  }
> 
>  static int i40evf_dev_xstats_get_names(__rte_unused struct rte_eth_dev
> *dev,
> --
> 2.10.3.dirty



More information about the dev mailing list