mac80211: fix sw scan locking
authorJohannes Berg <johannes.berg@intel.com>
Thu, 7 Oct 2010 10:55:24 +0000 (12:55 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 7 Oct 2010 18:41:27 +0000 (14:41 -0400)
The recent scan overhaul broke locking
because now we can jump to code that
attempts to unlock, while we don't have
the mutex held. Fix this by holding the
mutex around all the relevant code.

Reported-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/scan.c

index 523db930dabbde0eea60948750a0a1cb0204c07b..fb274db77e3cc73a1b1d9f537966ffc0a8a0cd14 100644 (file)
@@ -681,8 +681,6 @@ void ieee80211_scan_work(struct work_struct *work)
                goto out_complete;
        }
 
-       mutex_unlock(&local->mtx);
-
        /*
         * as long as no delay is required advance immediately
         * without scheduling a new work
@@ -713,6 +711,7 @@ void ieee80211_scan_work(struct work_struct *work)
        } while (next_delay == 0);
 
        ieee80211_queue_delayed_work(&local->hw, &local->scan_work, next_delay);
+       mutex_unlock(&local->mtx);
        return;
 
 out_complete: