提交 380a942b 编写于 作者: J Johannes Berg 提交者: John W. Linville

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: NJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 bebb8a5e
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册