Merge branch 'upstream' into upstream-jgarzik
[pandora-kernel.git] / net / ieee80211 / softmac / ieee80211softmac_wx.c
index 89c83fa..f13937b 100644 (file)
@@ -142,14 +142,14 @@ ieee80211softmac_wx_get_essid(struct net_device *net_dev,
        /* If all fails, return ANY (empty) */
        data->essid.length = 0;
        data->essid.flags = 0;  /* active */
-       
+
        /* If we have a statically configured ESSID then return it */
        if (sm->associnfo.static_essid) {
                data->essid.length = sm->associnfo.req_essid.len;
                data->essid.flags = 1;  /* active */
                memcpy(extra, sm->associnfo.req_essid.data, sm->associnfo.req_essid.len);
        }
-       
+
        /* If we're associating/associated, return that */
        if (sm->associnfo.associated || sm->associnfo.associating) {
                data->essid.length = sm->associnfo.associate_essid.len;
@@ -242,7 +242,7 @@ ieee80211softmac_wx_set_rate(struct net_device *net_dev,
        ieee80211softmac_recalc_txrates(mac);
        err = 0;
 
-out_unlock:    
+out_unlock:
        spin_unlock_irqrestore(&mac->lock, flags);
 out:
        return err;
@@ -260,6 +260,12 @@ ieee80211softmac_wx_get_rate(struct net_device *net_dev,
        int err = -EINVAL;
 
        spin_lock_irqsave(&mac->lock, flags);
+
+       if (unlikely(!mac->running)) {
+               err = -ENODEV;
+               goto out_unlock;
+       }
+
        switch (mac->txrates.default_rate) {
        case IEEE80211_CCK_RATE_1MB:
                data->bitrate.value = 1000000;
@@ -355,7 +361,7 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev,
        } else if (is_zero_ether_addr(data->ap_addr.sa_data)) {
                /* the bssid we have is no longer fixed */
                mac->associnfo.bssfixed = 0;
-        } else {
+       } else {
                if (!memcmp(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN)) {
                        if (mac->associnfo.associating || mac->associnfo.associated) {
                        /* bssid unchanged and associated or associating - just return */
@@ -369,7 +375,7 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev,
                mac->associnfo.bssfixed = 1;
                /* queue associate if new bssid or (old one again and not associated) */
                schedule_delayed_work(&mac->associnfo.work, 0);
-        }
+       }
 
  out:
        mutex_unlock(&mac->associnfo.mutex);
@@ -426,7 +432,7 @@ ieee80211softmac_wx_set_genie(struct net_device *dev,
                mac->wpa.IEbuflen = 0;
        }
 
- out:  
+ out:
        spin_unlock_irqrestore(&mac->lock, flags);
        mutex_unlock(&mac->associnfo.mutex);
 
@@ -447,9 +453,9 @@ ieee80211softmac_wx_get_genie(struct net_device *dev,
 
        mutex_lock(&mac->associnfo.mutex);
        spin_lock_irqsave(&mac->lock, flags);
-       
+
        wrqu->data.length = 0;
-       
+
        if (mac->wpa.IE && mac->wpa.IElen) {
                wrqu->data.length = mac->wpa.IElen;
                if (mac->wpa.IElen <= space)