patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/mlx5: fix xstats functions unlock missing
@ 2017-08-14 11:32 Matan Azrad
  2017-08-23 15:09 ` Nélio Laranjeiro
  0 siblings, 1 reply; 3+ messages in thread
From: Matan Azrad @ 2017-08-14 11:32 UTC (permalink / raw)
  To: Adrien Mazarguil, Nelio Laranjeiro; +Cc: dev, Shahaf Shuler, stable

The corrupted code didn't unlock the spinlock in xstats
get and reset functions error flow.

Hence, if these errors happaned, 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")

Signed-off-by: Matan Azrad <matan@mellanox.com>
Cc: stable@dpdk.org
---
 drivers/net/mlx5/mlx5_stats.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 703f48c..33997af 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -442,8 +442,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);
@@ -468,10 +470,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);
 }
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] net/mlx5: fix xstats functions unlock missing
  2017-08-14 11:32 [dpdk-stable] [PATCH] net/mlx5: fix xstats functions unlock missing Matan Azrad
@ 2017-08-23 15:09 ` Nélio Laranjeiro
  2017-08-24 12:13   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Nélio Laranjeiro @ 2017-08-23 15:09 UTC (permalink / raw)
  To: Matan Azrad; +Cc: Adrien Mazarguil, dev, Shahaf Shuler, stable

On Mon, Aug 14, 2017 at 02:32:24PM +0300, Matan Azrad wrote:
> The corrupted code didn't unlock the spinlock in xstats
> get and reset functions error flow.
> 
> Hence, if these errors happaned, 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")
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> Cc: stable@dpdk.org
> ---
>  drivers/net/mlx5/mlx5_stats.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
> index 703f48c..33997af 100644
> --- a/drivers/net/mlx5/mlx5_stats.c
> +++ b/drivers/net/mlx5/mlx5_stats.c
> @@ -442,8 +442,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);
> @@ -468,10 +470,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);
>  }
>  
> -- 
> 2.7.4
> 

Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] net/mlx5: fix xstats functions unlock missing
  2017-08-23 15:09 ` Nélio Laranjeiro
@ 2017-08-24 12:13   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2017-08-24 12:13 UTC (permalink / raw)
  To: Nélio Laranjeiro, Matan Azrad
  Cc: Adrien Mazarguil, dev, Shahaf Shuler, stable

On 8/23/2017 4:09 PM, Nélio Laranjeiro wrote:
> On Mon, Aug 14, 2017 at 02:32:24PM +0300, Matan Azrad wrote:
>> The corrupted code didn't unlock the spinlock in xstats
>> get and reset functions error flow.
>>
>> Hence, if these errors happaned, 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>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-24 12:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-14 11:32 [dpdk-stable] [PATCH] net/mlx5: fix xstats functions unlock missing Matan Azrad
2017-08-23 15:09 ` Nélio Laranjeiro
2017-08-24 12:13   ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).