Skip to contentSkip to conversation

alx: fix a double unlock in alx_probe()

PATCH In review Dan Carpenter 2 participants 3 messages May 17, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 alx: fix a double unlock in alx_probe()

We're not holding the lock at this point so "goto unlock;" should be "goto unmap;"

Fixes 4a5fe57e7751 ("alx: use fine-grained locking instead of RTNL")
---
 drivers/net/ethernet/atheros/alx/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/atheros/alx/main.c +1 -1
index e8884879a50f..45e380f3b065 100644
@@ -1859,7 +1859,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	err = register_netdev(netdev);
 	if (err) {
 		dev_err(&pdev->dev, "register netdevice failed\n");
-		goto out_unlock;
+		goto out_unmap;
 	}
 
 	netdev_info(netdev,
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/2 alx: unlock on error in alx_set_pauseparam()

We need to drop the lock before returning on this error path.

Fixes 4a5fe57e7751 ("alx: use fine-grained locking instead of RTNL")
---
 drivers/net/ethernet/atheros/alx/ethtool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/atheros/alx/ethtool.c +3 -1
index f3627157a38a..b716adacd815 100644
@@ -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 */
Signature · 1 line
2.30.2
#2 lore raw

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

Quoted 1 line · Dan Carpenter

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