[PATCH] softmac: make non-operational after being stopped
zd1211 with softmac and wpa_supplicant revealed an issue with softmac and the use of workqueues. Some of the work functions actually reschedule themselves, so this meant that there could still be pending work after flush_scheduled_work() had been called during ieee80211softmac_stop(). This patch introduces a "running" flag which is used to ensure that rescheduling does not happen in this situation. I also used this flag to ensure that softmac's hooks into ieee80211 are non-operational once the stop operation has been started. This simply makes softmac a little more robust, because I could crash it easily by receiving frames in the short timeframe after shutting down softmac and before turning off the ZD1211 radio. (ZD1211 is now fixed as well!) Signed-off-by: Daniel Drake <dsd@gentoo.org> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
995c99268e
commit
d57336e3f2
@@ -86,6 +86,11 @@ ieee80211softmac_auth_queue(void *data)
|
||||
|
||||
/* Lock and set flags */
|
||||
spin_lock_irqsave(&mac->lock, flags);
|
||||
if (unlikely(!mac->running)) {
|
||||
/* Prevent reschedule on workqueue flush */
|
||||
spin_unlock_irqrestore(&mac->lock, flags);
|
||||
return;
|
||||
}
|
||||
net->authenticated = 0;
|
||||
net->authenticating = 1;
|
||||
/* add a timeout call so we eventually give up waiting for an auth reply */
|
||||
@@ -124,6 +129,9 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
|
||||
unsigned long flags;
|
||||
u8 * data;
|
||||
|
||||
if (unlikely(!mac->running))
|
||||
return -ENODEV;
|
||||
|
||||
/* Find correct auth queue item */
|
||||
spin_lock_irqsave(&mac->lock, flags);
|
||||
list_for_each(list_ptr, &mac->auth_queue) {
|
||||
@@ -336,6 +344,9 @@ ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *de
|
||||
struct ieee80211softmac_network *net = NULL;
|
||||
struct ieee80211softmac_device *mac = ieee80211_priv(dev);
|
||||
|
||||
if (unlikely(!mac->running))
|
||||
return -ENODEV;
|
||||
|
||||
if (!deauth) {
|
||||
dprintk("deauth without deauth packet. eek!\n");
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user