DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/axgbe: fix protential unreleased lock problem in axgbe_i2c_xfer
@ 2021-08-26 11:54 Chengfeng Ye
  0 siblings, 0 replies; only message in thread
From: Chengfeng Ye @ 2021-08-26 11:54 UTC (permalink / raw)
  To: asomalap; +Cc: dev, Chengfeng Ye

The lock pdata->i2c_mutex is not released if the function return in these two patched branches, which may lead to deadlock problem if this lock is acuired again. The patch is to fix this problem.

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

Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
---
 drivers/net/axgbe/axgbe_i2c.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/axgbe/axgbe_i2c.c b/drivers/net/axgbe/axgbe_i2c.c
index ab3738a12e..a2798f484e 100644
--- a/drivers/net/axgbe/axgbe_i2c.c
+++ b/drivers/net/axgbe/axgbe_i2c.c
@@ -233,6 +233,7 @@ static int axgbe_i2c_xfer(struct axgbe_port *pdata, struct axgbe_i2c_op *op)
 	ret = axgbe_i2c_disable(pdata);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "failed to disable i2c master\n");
+		pthread_mutex_unlock(&pdata->i2c_mutex);
 		return ret;
 	}
 
@@ -249,6 +250,7 @@ static int axgbe_i2c_xfer(struct axgbe_port *pdata, struct axgbe_i2c_op *op)
 	ret = axgbe_i2c_enable(pdata);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "failed to enable i2c master\n");
+		pthread_mutex_unlock(&pdata->i2c_mutex);
 		return ret;
 	}
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-26 17:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26 11:54 [dpdk-dev] [PATCH] net/axgbe: fix protential unreleased lock problem in axgbe_i2c_xfer Chengfeng Ye

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).