Skip to contentSkip to conversation

New: at76c50x-usb mutex deadlock

Bugme-new In review Andrew Morton 3 participants 3 messages May 28, 2009 – Jun 1, 2009 1 message not in the archive Networking drivers (wireless)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]/

#1 lore raw

(switched to email. Please respond via emailed reply-to-all, not via the bugzilla web interface).

Quoted 19 lines · On Thu, 14 May 2009 20:54:54 GMT [email protected] wrote:

http://bugzilla.kernel.org/show_bug.cgi?id=13312

           Summary: at76c50x-usb mutex deadlock
           Product: Drivers
           Version: 2.5
    Kernel Version: 2.6.30-rc5
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: network-wireless
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
        Regression: No
Quoted 9 lines

at76_dwork_hw_scan() does a mutex_lock and then calls ieee80211_scan_completed(). This in turn calls at76_config() which then tries to do the same mutex_lock and thus the driver goes into deadlock.

I believe the solution would be for at76_dwork_hw_scan() to unlock the mutex before calling ieee80211_scan_completed(). I've tried this with my card, and it does indeed avoid the lockup - though I have yet to get the card working properly with this driver.

umm, is anyone looking at [email protected]? This one seems a bit of a no-brainer?

#2 lore raw

PATCH 1/1 at76c50x-usb: avoid mutex deadlock in at76_dwork_hw_scan

http://bugzilla.kernel.org/show_bug.cgi?id=13312

at76_dwork_hw_scan holds a mutex while calling ieee80211_scan_completed, which then calls at76_config which needs the same mutex. This reworks the ordering to not hold the lock while calling ieee80211_scan_completed.

---
 drivers/net/wireless/at76c50x-usb.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/at76c50x-usb.c +6 -6
index e3caeef..b51281f 100644
@@ -1873,18 +1873,18 @@ static void at76_dwork_hw_scan(struct work_struct *work)
 	if (ret != CMD_STATUS_COMPLETE) {
 		queue_delayed_work(priv->hw->workqueue, &priv->dwork_hw_scan,
 				   SCAN_POLL_INTERVAL);
-		goto exit;
+		mutex_unlock(&priv->mtx);
+		return;
 	}
 
-	ieee80211_scan_completed(priv->hw, false);
-
 	if (is_valid_ether_addr(priv->bssid))
 		at76_join(priv);
 
-	ieee80211_wake_queues(priv->hw);
-
-exit:
 	mutex_unlock(&priv->mtx);
+
+	ieee80211_scan_completed(priv->hw, false);
+
+	ieee80211_wake_queues(priv->hw);
 }
 
 static int at76_hw_scan(struct ieee80211_hw *hw,
Signature · 1 line
1.6.0.6
Acked-by on v1 1/1
#3 lore raw

Re: [PATCH] at76c50x-usb: avoid mutex deadlock in at76_dwork_hw_scan

Quoted 7 lines · John W. Linville

http://bugzilla.kernel.org/show_bug.cgi?id=13312

at76_dwork_hw_scan holds a mutex while calling ieee80211_scan_completed, which then calls at76_config which needs the same mutex. This reworks the ordering to not hold the lock while calling ieee80211_scan_completed.

Thanks.

Signature · 1 line
Kalle Valo