aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-02-27 03:56:40 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-03-06 15:30:47 -0500
commit03e4497ebeaa8011eb0ab0a54496ed6413b9d1a4 (patch)
tree96eb34d88a56f84f06f155e1d4a0d6d34d0f7933 /net/mac80211/cfg.c
parentdbbea6713d6096cd1c411cb453a6b71292c78b33 (diff)
mac80211: fix sta_info mesh timer bug
I noticed a bug I introduced when mesh is enabled: sta_info_destroy() will end up calling cancel_timer() on a timer that has never been initialized because the timer is only initialized in mesh_plink_alloc(), not in sta_info_alloc(). This patch moves the initialization of all mesh related fields into sta_info_alloc(), adds a bit of sanity checking to the cfg80211 handlers and sta_info_insert() and makes mesh_plink_alloc() a static helper function that is only used from the mesh plink code. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Cc: Luis Carlos Cobo <luisca@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6263cfc148c0..69238fa67bf2 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -17,8 +17,6 @@
17#include "ieee80211_rate.h" 17#include "ieee80211_rate.h"
18#include "mesh.h" 18#include "mesh.h"
19 19
20#define DEFAULT_RATES 0
21
22static enum ieee80211_if_types 20static enum ieee80211_if_types
23nl80211_type_to_mac80211_type(enum nl80211_iftype type) 21nl80211_type_to_mac80211_type(enum nl80211_iftype type)
24{ 22{
@@ -654,10 +652,13 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
654 } else 652 } else
655 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 653 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
656 654
657 if (ieee80211_vif_is_mesh(&sdata->vif)) 655 if (compare_ether_addr(mac, dev->dev_addr) == 0)
658 sta = mesh_plink_alloc(sdata, mac, DEFAULT_RATES, GFP_KERNEL); 656 return -EINVAL;
659 else 657
660 sta = sta_info_alloc(sdata, mac, GFP_KERNEL); 658 if (is_multicast_ether_addr(mac))
659 return -EINVAL;
660
661 sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
661 if (!sta) 662 if (!sta)
662 return -ENOMEM; 663 return -ENOMEM;
663 664