Skip to content

Commit

Permalink
mac80211: fix ieee80211_ioctl_giwrate
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Apr 8, 2008
1 parent bebb8a5 commit 380a942
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions net/mac80211/ieee80211_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 380a942

Please sign in to comment.