aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_sta.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-04-01 09:21:00 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-01 17:14:10 -0400
commit93e5deb1ae39b56f4743955e76c72251256f23c1 (patch)
tree415d4f11449452822bdd1a97760de67ffd8c452d /net/mac80211/ieee80211_sta.c
parent97bff8ecf4e4e26749a67dcfbb7565d8a0f4acb4 (diff)
mac80211: automatically free sta struct when insertion fails
When STA structure insertion fails, it has been allocated but isn't really alive yet, it isn't reachable by any other code and also can't yet have much configured. This patch changes the code so that when the insertion fails, the resulting STA pointer is no longer valid because it is freed. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ieee80211_sta.c')
-rw-r--r--net/mac80211/ieee80211_sta.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index baa68575b98a..00fde111c268 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -1942,7 +1942,6 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1942 if (err) { 1942 if (err) {
1943 printk(KERN_DEBUG "%s: failed to insert STA entry for" 1943 printk(KERN_DEBUG "%s: failed to insert STA entry for"
1944 " the AP (error %d)\n", dev->name, err); 1944 " the AP (error %d)\n", dev->name, err);
1945 sta_info_destroy(sta);
1946 rcu_read_unlock(); 1945 rcu_read_unlock();
1947 return; 1946 return;
1948 } 1947 }
@@ -4172,10 +4171,8 @@ struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
4172 4171
4173 rate_control_rate_init(sta, local); 4172 rate_control_rate_init(sta, local);
4174 4173
4175 if (sta_info_insert(sta)) { 4174 if (sta_info_insert(sta))
4176 sta_info_destroy(sta);
4177 return NULL; 4175 return NULL;
4178 }
4179 4176
4180 return sta; 4177 return sta;
4181} 4178}