summaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-04-04 23:40:35 +0200
committerJohn W. Linville <linville@tuxdriver.com>2008-04-08 16:44:43 -0400
commit380a942b9177dcae1429fdd0f3639f92d9ab139d (patch)
tree4ae093002b6fe9289c3d888858b80c35ccab6f6b /net/mac80211
parentbebb8a5e2cd30adcc5e9a14c3366a231da728aee (diff)
downloadop-kernel-dev-380a942b9177dcae1429fdd0f3639f92d9ab139d.zip
op-kernel-dev-380a942b9177dcae1429fdd0f3639f92d9ab139d.tar.gz
mac80211: fix ieee80211_ioctl_giwrate
The ieee80211_ioctl_giwrate() ioctl handler doesn't rcu_read_lock() its access to the sta table, fix it. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/ieee80211_ioctl.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index b047eeb..41130b3 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -586,19 +586,25 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev,
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
- if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
- sta = sta_info_get(local, sdata->u.sta.bssid);
- else
+ if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
return -EOPNOTSUPP;
- if (!sta)
- return -ENODEV;
sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
- if (sta->txrate_idx < sband->n_bitrates)
+ rcu_read_lock();
+
+ sta = sta_info_get(local, sdata->u.sta.bssid);
+
+ if (sta && sta->txrate_idx < sband->n_bitrates)
rate->value = sband->bitrates[sta->txrate_idx].bitrate;
else
rate->value = 0;
+
+ rcu_read_unlock();
+
+ if (!sta)
+ return -ENODEV;
+
rate->value *= 100000;
return 0;
OpenPOWER on IntegriCloud