diff mbox series

[2/2,net-next] alx: unlock on error in alx_set_pauseparam()

Message ID YKIwPe2/k1R+PTWU@mwanda (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series [1/2,net-next] alx: fix a double unlock in alx_probe() | expand

Checks

Context Check Description
netdev/apply fail Patch does not apply to net-next
netdev/tree_selection success Clearly marked for net-next

Commit Message

Dan Carpenter May 17, 2021, 8:58 a.m. UTC
We need to drop the lock before returning on this error path.

Fixes: 4a5fe57e7751 ("alx: use fine-grained locking instead of RTNL")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/atheros/alx/ethtool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Johannes Berg May 17, 2021, 9:12 a.m. UTC | #1
On Mon, 2021-05-17 at 11:58 +0300, Dan Carpenter wrote:
> We need to drop the lock before returning on this error path.

Haha, how many locking errors can I have in a single patch :(

Sorry, and thanks for all the fixes!

johannes
diff mbox series

Patch

diff --git a/drivers/net/ethernet/atheros/alx/ethtool.c b/drivers/net/ethernet/atheros/alx/ethtool.c
index f3627157a38a..b716adacd815 100644
--- a/drivers/net/ethernet/atheros/alx/ethtool.c
+++ b/drivers/net/ethernet/atheros/alx/ethtool.c
@@ -253,8 +253,10 @@  static int alx_set_pauseparam(struct net_device *netdev,
 
 	if (reconfig_phy) {
 		err = alx_setup_speed_duplex(hw, hw->adv_cfg, fc);
-		if (err)
+		if (err) {
+			mutex_unlock(&alx->mtx);
 			return err;
+		}
 	}
 
 	/* flow control on mac */