From: Chengfeng Ye Date: Thu, 26 Aug 2021 18:55:59 +0000 (-0700) Subject: net/axgbe: fix unreleased lock in I2C transfer X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;ds=sidebyside;h=30b4d95a29b1bf7e868d799952aa1fa1348d5e25;p=dpdk.git net/axgbe: fix unreleased lock in I2C transfer 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 acquired again. Bugzilla ID: 777 Fixes: 4ac7516b8b39 ("net/axgbe: add phy init and related APIs") Cc: stable@dpdk.org Signed-off-by: Chengfeng Ye Reviewed-by: Ferruh Yigit --- 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; }