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

Message ID 20180111134814.1224-1-dharton@cisco.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

David Harton Jan. 11, 2018, 1:48 p.m. UTC
  Calling i40evf_dev_xstats_reset can sometimes crash.

Fixed issue by adding a pstats NULL check.

Fixes: 8210e9e0d805e ("net/i40e: fix clear xstats bug in VF")
Cc: wei.zhao1@intel.com

Signed-off-by: David C Harton <dharton@cisco.com>
---

v2:
* Fixed fixes line in commit message.


 drivers/net/i40e/i40e_ethdev_vf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

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,