From: Pavlo Shcherbyna <pavlo.shcherbyna@harmonicinc.com>
To: adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com
Cc: dev@dpdk.org, Pavlo Shcherbyna <pavlo.shcherbyna@harmonicinc.com>,
shahafs@mellanox.com
Subject: [dpdk-dev] [PATCH] net/mlx5: release spinlock before return from function
Date: Fri, 29 Sep 2017 03:03:56 +0300 [thread overview]
Message-ID: <1506643436-15561-1-git-send-email-pavlo.shcherbyna@harmonicinc.com> (raw)
If priv_ethtool_get_stats_n fails to retrieve statistics, lock
is not released. Next call of function, which uses the same
spinlock, will stuck trying to obtain it.
This patch addresses the issue.
Fixes: 4b2e6df26168 ("net/mlx5: fix extended statistics counters identification")
Cc: shahafs@mellanox.com
Signed-off-by: Pavlo Shcherbyna <pavlo.shcherbyna@harmonicinc.com>
---
drivers/net/mlx5/mlx5_stats.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 703f48c..8764829 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -442,8 +442,10 @@ struct mlx5_counter_ctrl {
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);
@@ -467,8 +469,10 @@ struct mlx5_counter_ctrl {
priv_lock(priv);
stats_n = priv_ethtool_get_stats_n(priv);
- if (stats_n < 0)
+ if (stats_n < 0) {
+ priv_unlock(priv);
return;
+ }
if (xstats_ctrl->stats_n != stats_n)
priv_xstats_init(priv);
priv_xstats_reset(priv);
--
1.7.10.4
next reply other threads:[~2017-09-29 0:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-29 0:03 Pavlo Shcherbyna [this message]
2017-09-29 6:55 ` Nélio Laranjeiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1506643436-15561-1-git-send-email-pavlo.shcherbyna@harmonicinc.com \
--to=pavlo.shcherbyna@harmonicinc.com \
--cc=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=nelio.laranjeiro@6wind.com \
--cc=shahafs@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).