mac80211: avoid excessive stack usage in sta_info
[pandora-kernel.git] / net / mac80211 / sta_info.c
index 1914f5a..6dcb080 100644 (file)
@@ -344,12 +344,16 @@ static int sta_info_finish_insert(struct sta_info *sta,
 {
        struct ieee80211_local *local = sta->local;
        struct ieee80211_sub_if_data *sdata = sta->sdata;
-       struct station_info sinfo;
+       struct station_info *sinfo;
        unsigned long flags;
        int err = 0;
 
        lockdep_assert_held(&local->sta_mtx);
 
+       sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL);
+       if (!sinfo)
+               return -ENOMEM;
+
        if (!sta->dummy || dummy_reinsert) {
                /* notify driver */
                if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
@@ -397,12 +401,11 @@ static int sta_info_finish_insert(struct sta_info *sta,
                ieee80211_sta_debugfs_add(sta);
                rate_control_add_sta_debugfs(sta);
 
-               memset(&sinfo, 0, sizeof(sinfo));
-               sinfo.filled = 0;
-               sinfo.generation = local->sta_generation;
-               cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL);
+               sinfo->generation = local->sta_generation;
+               cfg80211_new_sta(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL);
        }
 
+       kfree(sinfo);
        return 0;
 }