diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-04-10 09:36:09 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-04-16 14:53:22 -0400 |
commit | 98dd6a575928ed9c42130d208e6bfb0f7a914d5a (patch) | |
tree | 5fd946b2080a8aa68e75742ea958e768cace46cb | |
parent | 171afcd4ba093b50cd2fb33fe2371fbc1f7fd389 (diff) |
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: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | net/mac80211/cfg.c | 20 | ||||
-rw-r--r-- | net/mac80211/wext.c | 5 |
2 files changed, 22 insertions, 3 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 8af576c1d2f1..0c1095aa94dd 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -718,12 +718,18 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, | |||
718 | struct sta_info *sta; | 718 | struct sta_info *sta; |
719 | 719 | ||
720 | if (mac) { | 720 | if (mac) { |
721 | rcu_read_lock(); | ||
722 | |||
721 | /* XXX: get sta belonging to dev */ | 723 | /* XXX: get sta belonging to dev */ |
722 | sta = sta_info_get(local, mac); | 724 | sta = sta_info_get(local, mac); |
723 | if (!sta) | 725 | if (!sta) { |
726 | rcu_read_unlock(); | ||
724 | return -ENOENT; | 727 | return -ENOENT; |
728 | } | ||
725 | 729 | ||
726 | sta_info_unlink(&sta); | 730 | sta_info_unlink(&sta); |
731 | rcu_read_unlock(); | ||
732 | |||
727 | sta_info_destroy(sta); | 733 | sta_info_destroy(sta); |
728 | } else | 734 | } else |
729 | sta_info_flush(local, sdata); | 735 | sta_info_flush(local, sdata); |
@@ -740,17 +746,23 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
740 | struct sta_info *sta; | 746 | struct sta_info *sta; |
741 | struct ieee80211_sub_if_data *vlansdata; | 747 | struct ieee80211_sub_if_data *vlansdata; |
742 | 748 | ||
749 | rcu_read_lock(); | ||
750 | |||
743 | /* XXX: get sta belonging to dev */ | 751 | /* XXX: get sta belonging to dev */ |
744 | sta = sta_info_get(local, mac); | 752 | sta = sta_info_get(local, mac); |
745 | if (!sta) | 753 | if (!sta) { |
754 | rcu_read_unlock(); | ||
746 | return -ENOENT; | 755 | return -ENOENT; |
756 | } | ||
747 | 757 | ||
748 | if (params->vlan && params->vlan != sta->sdata->dev) { | 758 | if (params->vlan && params->vlan != sta->sdata->dev) { |
749 | vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); | 759 | vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); |
750 | 760 | ||
751 | if (vlansdata->vif.type != IEEE80211_IF_TYPE_VLAN || | 761 | if (vlansdata->vif.type != IEEE80211_IF_TYPE_VLAN || |
752 | vlansdata->vif.type != IEEE80211_IF_TYPE_AP) | 762 | vlansdata->vif.type != IEEE80211_IF_TYPE_AP) { |
763 | rcu_read_unlock(); | ||
753 | return -EINVAL; | 764 | return -EINVAL; |
765 | } | ||
754 | 766 | ||
755 | sta->sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); | 767 | sta->sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); |
756 | ieee80211_send_layer2_update(sta); | 768 | ieee80211_send_layer2_update(sta); |
@@ -758,6 +770,8 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
758 | 770 | ||
759 | sta_apply_parameters(local, sta, params); | 771 | sta_apply_parameters(local, sta, params); |
760 | 772 | ||
773 | rcu_read_unlock(); | ||
774 | |||
761 | return 0; | 775 | return 0; |
762 | } | 776 | } |
763 | 777 | ||
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 69aed16faff3..5a452575719d 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -980,6 +980,8 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev | |||
980 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 980 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
981 | struct sta_info *sta = NULL; | 981 | struct sta_info *sta = NULL; |
982 | 982 | ||
983 | rcu_read_lock(); | ||
984 | |||
983 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 985 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
984 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) | 986 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) |
985 | sta = sta_info_get(local, sdata->u.sta.bssid); | 987 | 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 | wstats->qual.noise = sta->last_noise; | 998 | wstats->qual.noise = sta->last_noise; |
997 | wstats->qual.updated = local->wstats_flags; | 999 | wstats->qual.updated = local->wstats_flags; |
998 | } | 1000 | } |
1001 | |||
1002 | rcu_read_unlock(); | ||
1003 | |||
999 | return wstats; | 1004 | return wstats; |
1000 | } | 1005 | } |
1001 | 1006 | ||