Merge branch 'for-2637/i2c-all' of git://git.fluff.org/bjdooks/linux
[pandora-kernel.git] / net / mac80211 / sta_info.c
index 44e10a9..6d8f897 100644 (file)
@@ -616,7 +616,7 @@ static int __must_check __sta_info_destroy(struct sta_info *sta)
        struct ieee80211_sub_if_data *sdata;
        struct sk_buff *skb;
        unsigned long flags;
-       int ret;
+       int ret, i;
 
        might_sleep();
 
@@ -633,7 +633,7 @@ static int __must_check __sta_info_destroy(struct sta_info *sta)
         * will be sufficient.
         */
        set_sta_flags(sta, WLAN_STA_BLOCK_BA);
-       ieee80211_sta_tear_down_BA_sessions(sta);
+       ieee80211_sta_tear_down_BA_sessions(sta, true);
 
        spin_lock_irqsave(&local->sta_lock, flags);
        ret = sta_info_hash_del(local, sta);
@@ -644,10 +644,10 @@ static int __must_check __sta_info_destroy(struct sta_info *sta)
        if (ret)
                return ret;
 
-       if (sta->key) {
-               ieee80211_key_free(local, sta->key);
-               WARN_ON(sta->key);
-       }
+       for (i = 0; i < NUM_DEFAULT_KEYS; i++)
+               ieee80211_key_free(local, sta->gtk[i]);
+       if (sta->ptk)
+               ieee80211_key_free(local, sta->ptk);
 
        sta->dead = true;
 
@@ -838,13 +838,20 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
        mutex_unlock(&local->sta_mtx);
 }
 
-struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw,
-                                              const u8 *addr)
+struct ieee80211_sta *ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw,
+                                              const u8 *addr,
+                                              const u8 *localaddr)
 {
        struct sta_info *sta, *nxt;
 
-       /* Just return a random station ... first in list ... */
+       /*
+        * Just return a random station if localaddr is NULL
+        * ... first in list.
+        */
        for_each_sta_info(hw_to_local(hw), addr, sta, nxt) {
+               if (localaddr &&
+                   compare_ether_addr(sta->sdata->vif.addr, localaddr) != 0)
+                       continue;
                if (!sta->uploaded)
                        return NULL;
                return &sta->sta;
@@ -852,7 +859,7 @@ struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw,
 
        return NULL;
 }
-EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_hw);
+EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_ifaddr);
 
 struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif,
                                         const u8 *addr)