Skip to contentSkip to conversation

b43legacy: Fix locking problem

PATCH In review Larry Finger 2 participants 4 messages May 15, 2009 – May 19, 2009 1 message not in the archive Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/2 b43legacy: Fix locking problem

Commit abb1d2bca0fc429c136747a64e675dd4d8906f36 introduced a locking problem in b43legacy that caused the system to freeze upon booting.

---

John,

This is 2.6.31 material. I hope that you do not have trouble with this patch. While on the road, my normal method is not available.

This is resent as V2 to eliminate some patch offsets that resulted from the changes in V2 of patch 1.

Larry
---

 main.c |   25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)
drivers/net/wireless/b43legacy/main.c +4 -21
Index: wireless-testing/drivers/net/wireless/b43legacy/main.c
===================================================================
@@ -2767,29 +2767,18 @@ static void b43legacy_op_bss_info_change
 {
 	struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
 	struct b43legacy_wldev *dev;
-	struct b43legacy_phy *phy;
 	unsigned long flags;
 
 	mutex_lock(&wl->mutex);
-	B43legacy_WARN_ON(wl->vif != vif);
 
 	dev = wl->current_dev;
-	phy = &dev->phy;
-
-	/* Disable IRQs while reconfiguring the device.
-	 * This makes it possible to drop the spinlock throughout
-	 * the reconfiguration process. */
-	spin_lock_irqsave(&wl->irq_lock, flags);
-	if (b43legacy_status(dev) < B43legacy_STAT_STARTED) {
-		spin_unlock_irqrestore(&wl->irq_lock, flags);
+	if (!dev || b43legacy_status(dev) < B43legacy_STAT_STARTED)
 		goto out_unlock_mutex;
-	}
-	b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, 0);
 
-	if (changed & BSS_CHANGED_BSSID) {
-		spin_unlock_irqrestore(&wl->irq_lock, flags);
-		b43legacy_synchronize_irq(dev);
+	B43legacy_WARN_ON(wl->vif != vif);
 
+	if (changed & BSS_CHANGED_BSSID) {
+		spin_lock_irqsave(&wl->irq_lock, flags);
 		if (conf->bssid)
 			memcpy(wl->bssid, conf->bssid, ETH_ALEN);
 		else
@@ -2827,12 +2816,6 @@ static void b43legacy_op_bss_info_change
 	}
 
 	b43legacy_mac_enable(dev);
-
-	spin_lock_irqsave(&wl->irq_lock, flags);
-	b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, dev->irq_mask);
-	/* XXX: why? */
-	mmiowb();
-	spin_unlock_irqrestore(&wl->irq_lock, flags);
  out_unlock_mutex:
 	mutex_unlock(&wl->mutex);
 }
#1 lore raw
Quoted 8 lines · Larry Finger

Commit abb1d2bca0fc429c136747a64e675dd4d8906f36 introduced a locking problem in b43legacy that caused the system to freeze upon booting.

---

John,

Quoted 7 lines

This is 2.6.31 material. I hope that you do not have trouble with this patch. While on the road, my normal method is not available.

This is resent as V2 to eliminate some patch offsets that resulted from the changes in V2 of patch 1.

Larry

This conflicted w/ a patch from Johannes, and I couldn't easily figure-out how to resolve them. Since his claimed to fix something else along with this problem, I just applied his.

Also, please don't refer to commit IDs directly, especially ones that aren't already in linux-2.6. Instead, please refer to the patch subject. If the commit is already in linux-2.6, then a short reference to the commit ID is acceptable.

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#2 lore raw
Quoted 9 lines · John W. Linville

This conflicted w/ a patch from Johannes, and I couldn't easily figure-out how to resolve them. Since his claimed to fix something else along with this problem, I just applied his.

Also, please don't refer to commit IDs directly, especially ones that aren't already in linux-2.6. Instead, please refer to the patch subject. If the commit is already in linux-2.6, then a short reference to the commit ID is acceptable.

Sorry about the commit ID. I thought I had the title in there as well, but it appears not.

It was good to use the patch from Johannes. In addition to fixing another problem, he also had the opportunity to fix the locking problem that he broke.

BTW, b43legacy works in 2.6.30-rc6-wl.

Larry

#4 lore raw
In reply to a message not in the archive
Quoted 10 lines · 黄守旺

Hello everybody , my embedded system bases on arm( Intel's XScale ixp425),kernel is downloaded from kernel.org,version is 2.6.26.6

when i compile the B43 driver into kernel ,i can not to make BCM4318 and BCM4306 to work in AP mode.

can you tell me whether 4318 and 4306 really support ap mode?

Thansk for any hints

I am not certain that the b43 or mac80211 drivers in 2.6.26 will work in AP mode; however, if you use 2.6.29 and hostapd with version 0.6.X, then your BCM43xx devices should work. See the article at
http://forums.opensuse.org/network-internet/wireless/410475-how-setup-access-point.html.

Larry