summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_stats.c
diff options
context:
space:
mode:
authorMatan Azrad <matan@mellanox.com>2017-08-14 14:32:24 +0300
committerFerruh Yigit <ferruh.yigit@intel.com>2017-10-06 02:49:47 +0200
commitb5743da31eba03cdc7abae3295f8ba852919c4a3 (patch)
tree196dea03c7dff9d61bf5bd9bee55557ad03ec8c9 /drivers/net/mlx5/mlx5_stats.c
parentc4e9863c4db14442a38c868d2c899e246d64faea (diff)
downloaddpdk-b5743da31eba03cdc7abae3295f8ba852919c4a3.zip
dpdk-b5743da31eba03cdc7abae3295f8ba852919c4a3.tar.gz
dpdk-b5743da31eba03cdc7abae3295f8ba852919c4a3.tar.xz
net/mlx5: fix locking in xstats functions
The corrupted code didn't unlock the spinlock in xstats get and reset functions error flow. Hence, if these errors happened, the device spinlock was left locked and many mlx5 device functionalities were blocked. The fix unlocks the spinlock in the missed places. Fixes: e62bc9e70608 ("net/mlx5: fix extended statistics") Cc: stable@dpdk.org Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_stats.c')
-rw-r--r--drivers/net/mlx5/mlx5_stats.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 7b45c8c..d443e13 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -435,8 +435,10 @@ mlx5_xstats_get(struct rte_eth_dev *dev,
priv_lock(priv);
stats_n = priv_ethtool_get_stats_n(priv);
- if (stats_n < 0)
+ if (stats_n < 0) {
+ priv_unlock(priv);
return -1;
+ }
if (xstats_ctrl->stats_n != stats_n)
priv_xstats_init(priv);
ret = priv_xstats_get(priv, stats);
@@ -461,10 +463,11 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
priv_lock(priv);
stats_n = priv_ethtool_get_stats_n(priv);
if (stats_n < 0)
- return;
+ goto unlock;
if (xstats_ctrl->stats_n != stats_n)
priv_xstats_init(priv);
priv_xstats_reset(priv);
+unlock:
priv_unlock(priv);
}