aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_plink.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/mesh_plink.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/mesh_plink.c')
-rw-r--r--net/mac80211/mesh_plink.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 18fe52436c47..56c54e321b38 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -89,6 +89,10 @@ static inline void mesh_plink_fsm_restart(struct sta_info *sta)
89 sta->plink_retries = 0; 89 sta->plink_retries = 0;
90} 90}
91 91
92/*
93 * NOTE: This is just an alias for sta_info_alloc(), see notes
94 * on it in the lifecycle management section!
95 */
92static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata, 96static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata,
93 u8 *hw_addr, u64 rates) 97 u8 *hw_addr, u64 rates)
94{ 98{
@@ -235,7 +239,6 @@ void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct net_device *dev,
235 return; 239 return;
236 } 240 }
237 if (sta_info_insert(sta)) { 241 if (sta_info_insert(sta)) {
238 sta_info_destroy(sta);
239 rcu_read_unlock(); 242 rcu_read_unlock();
240 return; 243 return;
241 } 244 }
@@ -506,7 +509,6 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
506 return; 509 return;
507 } 510 }
508 if (sta_info_insert(sta)) { 511 if (sta_info_insert(sta)) {
509 sta_info_destroy(sta);
510 rcu_read_unlock(); 512 rcu_read_unlock();
511 return; 513 return;
512 } 514 }