···204205 /* couple of flags */206 u8 scanning:1, /* protects scanning from being done multiple times at once */207- associated:1;0208209 struct ieee80211softmac_scaninfo *scaninfo;210 struct ieee80211softmac_assoc_info associnfo;
···204205 /* couple of flags */206 u8 scanning:1, /* protects scanning from being done multiple times at once */207+ associated:1,208+ running:1;209210 struct ieee80211softmac_scaninfo *scaninfo;211 struct ieee80211softmac_assoc_info associnfo;
+15-2
net/ieee80211/softmac/ieee80211softmac_assoc.c
···51 spin_lock_irqsave(&mac->lock, flags);52 mac->associnfo.associating = 1;53 mac->associated = 0; /* just to make sure */54- spin_unlock_irqrestore(&mac->lock, flags);5556 /* Set a timer for timeout */57 /* FIXME: make timeout configurable */58- schedule_delayed_work(&mac->associnfo.timeout, 5 * HZ);0059}6061void···320 u16 status = le16_to_cpup(&resp->status);321 struct ieee80211softmac_network *network = NULL;322 unsigned long flags;000323324 spin_lock_irqsave(&mac->lock, flags);325···381{382 struct ieee80211softmac_device *mac = ieee80211_priv(dev);383 unsigned long flags;0000384 if (memcmp(disassoc->header.addr2, mac->associnfo.bssid, ETH_ALEN))385 return 0;0386 if (memcmp(disassoc->header.addr1, mac->dev->dev_addr, ETH_ALEN))387 return 0;0388 dprintk(KERN_INFO PFX "got disassoc frame\n");389 netif_carrier_off(dev);390 spin_lock_irqsave(&mac->lock, flags);···409{410 struct ieee80211softmac_device *mac = ieee80211_priv(dev);411 struct ieee80211softmac_network *network;000412413 network = ieee80211softmac_get_network_by_bssid(mac, resp->header.addr3);414 if (!network) {
···51 spin_lock_irqsave(&mac->lock, flags);52 mac->associnfo.associating = 1;53 mac->associated = 0; /* just to make sure */05455 /* Set a timer for timeout */56 /* FIXME: make timeout configurable */57+ if (likely(mac->running))58+ schedule_delayed_work(&mac->associnfo.timeout, 5 * HZ);59+ spin_unlock_irqrestore(&mac->lock, flags);60}6162void···319 u16 status = le16_to_cpup(&resp->status);320 struct ieee80211softmac_network *network = NULL;321 unsigned long flags;322+323+ if (unlikely(!mac->running))324+ return -ENODEV;325326 spin_lock_irqsave(&mac->lock, flags);327···377{378 struct ieee80211softmac_device *mac = ieee80211_priv(dev);379 unsigned long flags;380+381+ if (unlikely(!mac->running))382+ return -ENODEV;383+384 if (memcmp(disassoc->header.addr2, mac->associnfo.bssid, ETH_ALEN))385 return 0;386+387 if (memcmp(disassoc->header.addr1, mac->dev->dev_addr, ETH_ALEN))388 return 0;389+390 dprintk(KERN_INFO PFX "got disassoc frame\n");391 netif_carrier_off(dev);392 spin_lock_irqsave(&mac->lock, flags);···399{400 struct ieee80211softmac_device *mac = ieee80211_priv(dev);401 struct ieee80211softmac_network *network;402+403+ if (unlikely(!mac->running))404+ return -ENODEV;405406 network = ieee80211softmac_get_network_by_bssid(mac, resp->header.addr3);407 if (!network) {
+14-2
net/ieee80211/softmac/ieee80211softmac_auth.c
···8687 /* Lock and set flags */88 spin_lock_irqsave(&mac->lock, flags);0000089 net->authenticated = 0;90 net->authenticating = 1;91 /* add a timeout call so we eventually give up waiting for an auth reply */···129 unsigned long flags;130 u8 * data;131000132 /* Find correct auth queue item */133 spin_lock_irqsave(&mac->lock, flags);134 list_for_each(list_ptr, &mac->auth_queue) {···306307 /* can't transmit data right now... */308 netif_carrier_off(mac->dev);309- /* let's try to re-associate */310- schedule_work(&mac->associnfo.work);311 spin_unlock_irqrestore(&mac->lock, flags);312}313···344 struct ieee80211softmac_network *net = NULL;345 struct ieee80211softmac_device *mac = ieee80211_priv(dev);346000347 if (!deauth) {348 dprintk("deauth without deauth packet. eek!\n");349 return 0;···369 }370371 ieee80211softmac_deauth_from_net(mac, net);000372 return 0;373}
···8687 /* Lock and set flags */88 spin_lock_irqsave(&mac->lock, flags);89+ if (unlikely(!mac->running)) {90+ /* Prevent reschedule on workqueue flush */91+ spin_unlock_irqrestore(&mac->lock, flags);92+ return;93+ }94 net->authenticated = 0;95 net->authenticating = 1;96 /* add a timeout call so we eventually give up waiting for an auth reply */···124 unsigned long flags;125 u8 * data;126127+ if (unlikely(!mac->running))128+ return -ENODEV;129+130 /* Find correct auth queue item */131 spin_lock_irqsave(&mac->lock, flags);132 list_for_each(list_ptr, &mac->auth_queue) {···298299 /* can't transmit data right now... */300 netif_carrier_off(mac->dev);00301 spin_unlock_irqrestore(&mac->lock, flags);302}303···338 struct ieee80211softmac_network *net = NULL;339 struct ieee80211softmac_device *mac = ieee80211_priv(dev);340341+ if (unlikely(!mac->running))342+ return -ENODEV;343+344 if (!deauth) {345 dprintk("deauth without deauth packet. eek!\n");346 return 0;···360 }361362 ieee80211softmac_deauth_from_net(mac, net);363+364+ /* let's try to re-associate */365+ schedule_work(&mac->associnfo.work);366 return 0;367}
+4
net/ieee80211/softmac/ieee80211softmac_module.c
···89 ieee80211softmac_wait_for_scan(sm);9091 spin_lock_irqsave(&sm->lock, flags);0092 /* Free all pending assoc work items */93 cancel_delayed_work(&sm->associnfo.work);94···206 assert(0);207 if (mac->txrates_change)208 mac->txrates_change(dev, change, &oldrates);00209}210EXPORT_SYMBOL_GPL(ieee80211softmac_start);211
···89 ieee80211softmac_wait_for_scan(sm);9091 spin_lock_irqsave(&sm->lock, flags);92+ sm->running = 0;93+94 /* Free all pending assoc work items */95 cancel_delayed_work(&sm->associnfo.work);96···204 assert(0);205 if (mac->txrates_change)206 mac->txrates_change(dev, change, &oldrates);207+208+ mac->running = 1;209}210EXPORT_SYMBOL_GPL(ieee80211softmac_start);211
+8
net/ieee80211/softmac/ieee80211softmac_scan.c
···115 // TODO: is this if correct, or should we do this only if scanning from assoc request?116 if (sm->associnfo.req_essid.len)117 ieee80211softmac_send_mgt_frame(sm, &sm->associnfo.req_essid, IEEE80211_STYPE_PROBE_REQ, 0);0000000118 schedule_delayed_work(&si->softmac_scan, IEEE80211SOFTMAC_PROBE_DELAY);0119 return;120 } else {121 dprintk(PFX "Not probing Channel %d (not allowed here)\n", si->channels[current_channel_idx].channel);
···115 // TODO: is this if correct, or should we do this only if scanning from assoc request?116 if (sm->associnfo.req_essid.len)117 ieee80211softmac_send_mgt_frame(sm, &sm->associnfo.req_essid, IEEE80211_STYPE_PROBE_REQ, 0);118+119+ spin_lock_irqsave(&sm->lock, flags);120+ if (unlikely(!sm->running)) {121+ /* Prevent reschedule on workqueue flush */122+ spin_unlock_irqrestore(&sm->lock, flags);123+ break;124+ }125 schedule_delayed_work(&si->softmac_scan, IEEE80211SOFTMAC_PROBE_DELAY);126+ spin_unlock_irqrestore(&sm->lock, flags);127 return;128 } else {129 dprintk(PFX "Not probing Channel %d (not allowed here)\n", si->channels[current_channel_idx].channel);