Commit 98dd6a57 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: further RCU fixes

There were a few more instances of sta_info_get calls not being
protected by RCU, fix them.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 171afcd4
...@@ -718,12 +718,18 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -718,12 +718,18 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
struct sta_info *sta; struct sta_info *sta;
if (mac) { if (mac) {
rcu_read_lock();
/* XXX: get sta belonging to dev */ /* XXX: get sta belonging to dev */
sta = sta_info_get(local, mac); sta = sta_info_get(local, mac);
if (!sta) if (!sta) {
rcu_read_unlock();
return -ENOENT; return -ENOENT;
}
sta_info_unlink(&sta); sta_info_unlink(&sta);
rcu_read_unlock();
sta_info_destroy(sta); sta_info_destroy(sta);
} else } else
sta_info_flush(local, sdata); sta_info_flush(local, sdata);
...@@ -740,17 +746,23 @@ static int ieee80211_change_station(struct wiphy *wiphy, ...@@ -740,17 +746,23 @@ static int ieee80211_change_station(struct wiphy *wiphy,
struct sta_info *sta; struct sta_info *sta;
struct ieee80211_sub_if_data *vlansdata; struct ieee80211_sub_if_data *vlansdata;
rcu_read_lock();
/* XXX: get sta belonging to dev */ /* XXX: get sta belonging to dev */
sta = sta_info_get(local, mac); sta = sta_info_get(local, mac);
if (!sta) if (!sta) {
rcu_read_unlock();
return -ENOENT; return -ENOENT;
}
if (params->vlan && params->vlan != sta->sdata->dev) { if (params->vlan && params->vlan != sta->sdata->dev) {
vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
if (vlansdata->vif.type != IEEE80211_IF_TYPE_VLAN || if (vlansdata->vif.type != IEEE80211_IF_TYPE_VLAN ||
vlansdata->vif.type != IEEE80211_IF_TYPE_AP) vlansdata->vif.type != IEEE80211_IF_TYPE_AP) {
rcu_read_unlock();
return -EINVAL; return -EINVAL;
}
sta->sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); sta->sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
ieee80211_send_layer2_update(sta); ieee80211_send_layer2_update(sta);
...@@ -758,6 +770,8 @@ static int ieee80211_change_station(struct wiphy *wiphy, ...@@ -758,6 +770,8 @@ static int ieee80211_change_station(struct wiphy *wiphy,
sta_apply_parameters(local, sta, params); sta_apply_parameters(local, sta, params);
rcu_read_unlock();
return 0; return 0;
} }
......
...@@ -980,6 +980,8 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev ...@@ -980,6 +980,8 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct sta_info *sta = NULL; struct sta_info *sta = NULL;
rcu_read_lock();
if (sdata->vif.type == IEEE80211_IF_TYPE_STA || if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
sdata->vif.type == IEEE80211_IF_TYPE_IBSS) sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
sta = sta_info_get(local, sdata->u.sta.bssid); sta = sta_info_get(local, sdata->u.sta.bssid);
...@@ -996,6 +998,9 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev ...@@ -996,6 +998,9 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev
wstats->qual.noise = sta->last_noise; wstats->qual.noise = sta->last_noise;
wstats->qual.updated = local->wstats_flags; wstats->qual.updated = local->wstats_flags;
} }
rcu_read_unlock();
return wstats; return wstats;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment