All of lore.kernel.org
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix protential unreleased lock problem
@ 2021-08-26 11:45 Chengfeng Ye
  0 siblings, 0 replies; 2+ messages in thread
From: Chengfeng Ye @ 2021-08-26 11:45 UTC (permalink / raw)
  To: matan, shahafs, viacheslavo; +Cc: dev, Chengfeng Ye

The lock sh->txpp.mutex isn't correctly released if the function return in the patched branch, which may lead to deadlock if this lock is acuired again. The patch is to fix this problem.

Cc: cyeaa@connect.ust.hk
Bugzilla ID: 774

Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
---
 drivers/net/mlx5/mlx5_txpp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_txpp.c b/drivers/net/mlx5/mlx5_txpp.c
index 4f6da9f2d1..0ece788a84 100644
--- a/drivers/net/mlx5/mlx5_txpp.c
+++ b/drivers/net/mlx5/mlx5_txpp.c
@@ -961,8 +961,12 @@ mlx5_txpp_stop(struct rte_eth_dev *dev)
 	MLX5_ASSERT(!ret);
 	RTE_SET_USED(ret);
 	MLX5_ASSERT(sh->txpp.refcnt);
-	if (!sh->txpp.refcnt || --sh->txpp.refcnt)
+	if (!sh->txpp.refcnt || --sh->txpp.refcnt) {
+		ret = pthread_mutex_unlock(&sh->txpp.mutex);
+		MLX5_ASSERT(!ret);
+		RTE_SET_USED(ret);
 		return;
+	}
 	/* No references any more, do actual destroy. */
 	mlx5_txpp_destroy(sh);
 	ret = pthread_mutex_unlock(&sh->txpp.mutex);
-- 
2.17.1


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

* [dpdk-dev] [PATCH] net/mlx5: fix protential unreleased lock problem
@ 2021-08-26 12:24 Chengfeng Ye
  0 siblings, 0 replies; 2+ messages in thread
From: Chengfeng Ye @ 2021-08-26 12:24 UTC (permalink / raw)
  To: matan, viacheslavo, tzahio; +Cc: dev, Chengfeng Ye

The lock sh->txpp.mutex isn't correctly released if the function return in the patched branch, which may lead to deadlock if this lock is acuired again. The patch is to fix this problem.

Cc: cyeaa@connect.ust.hk
Bugzilla ID: 774

Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
---
 drivers/net/mlx5/mlx5_txpp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_txpp.c b/drivers/net/mlx5/mlx5_txpp.c
index 4f6da9f2d1..0ece788a84 100644
--- a/drivers/net/mlx5/mlx5_txpp.c
+++ b/drivers/net/mlx5/mlx5_txpp.c
@@ -961,8 +961,12 @@ mlx5_txpp_stop(struct rte_eth_dev *dev)
 	MLX5_ASSERT(!ret);
 	RTE_SET_USED(ret);
 	MLX5_ASSERT(sh->txpp.refcnt);
-	if (!sh->txpp.refcnt || --sh->txpp.refcnt)
+	if (!sh->txpp.refcnt || --sh->txpp.refcnt) {
+		ret = pthread_mutex_unlock(&sh->txpp.mutex);
+		MLX5_ASSERT(!ret);
+		RTE_SET_USED(ret);
 		return;
+	}
 	/* No references any more, do actual destroy. */
 	mlx5_txpp_destroy(sh);
 	ret = pthread_mutex_unlock(&sh->txpp.mutex);
-- 
2.17.1


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

end of thread, other threads:[~2021-08-26 17:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26 11:45 [dpdk-dev] [PATCH] net/mlx5: fix protential unreleased lock problem Chengfeng Ye
2021-08-26 12:24 Chengfeng Ye

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.