From: David Harton Date: Thu, 11 Jan 2018 15:13:58 +0000 (-0500) Subject: net/i40e: fix VF reset stats crash X-Git-Tag: spdx-start~323 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=cde1f0252811e81a3c485ca1932cc655736f1e49;p=dpdk.git net/i40e: fix VF reset stats crash Calling i40evf_dev_xstats_reset can sometimes crash. Fixed issue by checking return code before using pstats. Fixes: 8210e9e0d805 ("net/i40e: fix clear xstats bug in VF") Cc: stable@dpdk.org Signed-off-by: David Harton Acked-by: Harry van Haaren Acked-by: Wei Zhao --- diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 4d508620a1..0cca0d3249 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -916,14 +916,16 @@ i40evf_update_stats(struct i40e_vsi *vsi, static void i40evf_dev_xstats_reset(struct rte_eth_dev *dev) { + int ret; struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_eth_stats *pstats = NULL; /* read stat values to clear hardware registers */ - i40evf_query_stats(dev, &pstats); + ret = i40evf_query_stats(dev, &pstats); /* set stats offset base on current values */ - vf->vsi.eth_stats_offset = *pstats; + if (ret == 0) + vf->vsi.eth_stats_offset = *pstats; } static int i40evf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,