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>
This commit is contained in:
committed by
John W. Linville
parent
dbbea6713d
commit
03e4497ebe
@ -17,8 +17,6 @@
|
||||
#include "ieee80211_rate.h"
|
||||
#include "mesh.h"
|
||||
|
||||
#define DEFAULT_RATES 0
|
||||
|
||||
static enum ieee80211_if_types
|
||||
nl80211_type_to_mac80211_type(enum nl80211_iftype type)
|
||||
{
|
||||
@ -654,10 +652,13 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
|
||||
} else
|
||||
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
|
||||
if (ieee80211_vif_is_mesh(&sdata->vif))
|
||||
sta = mesh_plink_alloc(sdata, mac, DEFAULT_RATES, GFP_KERNEL);
|
||||
else
|
||||
sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
|
||||
if (compare_ether_addr(mac, dev->dev_addr) == 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (is_multicast_ether_addr(mac))
|
||||
return -EINVAL;
|
||||
|
||||
sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
|
||||
if (!sta)
|
||||
return -ENOMEM;
|
||||
|
||||
|
Reference in New Issue
Block a user