Skip to contentSkip to conversation

NET: phy_device, fix lock imbalance

PATCH Applied Jiri Slaby 2 participants 6 messages Jul 13, 2009 – Jul 14, 2009

Subsystems (3)
lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/2 NET: phy_device, fix lock imbalance

Don't forget to unlock a mutex in phy_scan_fixups on a fail path.

---
 drivers/net/phy/phy_device.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/phy/phy_device.c +3 -1
index eba937c..b10fedd 100644
@@ -134,8 +134,10 @@ int phy_scan_fixups(struct phy_device *phydev)
 
 			err = fixup->run(phydev);
 
-			if (err < 0)
+			if (err < 0) {
+				mutex_unlock(&phy_fixup_lock);
 				return err;
+			}
 		}
 	}
 	mutex_unlock(&phy_fixup_lock);
Signature · 1 line
1.6.3.2
author
#1 lore raw

PATCH 2/2 NET: sungem, use spin_trylock_irqsave

Use spin_trylock_irqsave instead of open-coded
local_irq_save+spin_trylock.

Impact: cleanup

---
 drivers/net/sungem.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/net/sungem.c +1 -3
index d2dfe0a..22474a8 100644
@@ -1032,10 +1032,8 @@ static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev)
 			(csum_stuff_off << 21));
 	}
 
-	local_irq_save(flags);
-	if (!spin_trylock(&gp->tx_lock)) {
+	if (!spin_trylock_irqsave(&gp->tx_lock)) {
 		/* Tell upper layer to requeue */
-		local_irq_restore(flags);
 		return NETDEV_TX_LOCKED;
 	}
 	/* We raced with gem_do_stop() */
Signature · 1 line
1.6.3.2
maintainer
#2 lore raw

Re: [PATCH 2/2] NET: sungem, use spin_trylock_irqsave

Please DO NOT combine cleanups with real bug fixes into a patch series.

Bug fixes go to one tree, the rest go to another tree, and that is especially the case this late in the RC series.

A series of patches are a group of changes that are supposed to be related and are expected to be applied all to the same tree. That is not true of the patches you have posted here.

maintainer
#3 lore raw

Re: [PATCH 2/2] NET: sungem, use spin_trylock_irqsave

In reply to Jiri Slaby

From: Jiri Slaby <[email protected]>
Date: Mon, 13 Jul 2009 23:23:40 +0200

drivers/net/sungem.c static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 1035

Quoted 2 lines
drivers/net/sungem.c +1 -1
-	if (!spin_trylock(&gp->tx_lock)) {
+	if (!spin_trylock_irqsave(&gp->tx_lock)) {

I'm about to give you a royal flaming.

Any idea why?

(hint: type 'make' before you send patches!!!!)

author
#4 lore raw

Re: [PATCH 2/2] NET: sungem, use spin_trylock_irqsave

Quoted 4 lines · David Miller

drivers/net/sungem.c static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 1035

Quoted 2 lines
drivers/net/sungem.c +1 -1
-	if (!spin_trylock(&gp->tx_lock)) {
+	if (!spin_trylock_irqsave(&gp->tx_lock)) {

(hint: type 'make' before you send patches!!!!)

Grr, I did but my bash_history shows that I built wrong subtree. My apologies.