From 93e5deb1ae39b56f4743955e76c72251256f23c1 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 1 Apr 2008 15:21:00 +0200 Subject: 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 Signed-off-by: John W. Linville --- net/mac80211/mesh_plink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'net/mac80211/mesh_plink.c') diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 18fe524..56c54e3 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) sta->plink_retries = 0; } +/* + * NOTE: This is just an alias for sta_info_alloc(), see notes + * on it in the lifecycle management section! + */ static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata, u8 *hw_addr, u64 rates) { @@ -235,7 +239,6 @@ void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct net_device *dev, return; } if (sta_info_insert(sta)) { - sta_info_destroy(sta); rcu_read_unlock(); return; } @@ -506,7 +509,6 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, return; } if (sta_info_insert(sta)) { - sta_info_destroy(sta); rcu_read_unlock(); return; } -- cgit v1.1