diff options
-rw-r--r-- | net/mac80211/ieee80211_ioctl.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c index b047eebb6330..41130b303170 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, | |||
586 | 586 | ||
587 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 587 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
588 | 588 | ||
589 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) | 589 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
590 | sta = sta_info_get(local, sdata->u.sta.bssid); | ||
591 | else | ||
592 | return -EOPNOTSUPP; | 590 | return -EOPNOTSUPP; |
593 | if (!sta) | ||
594 | return -ENODEV; | ||
595 | 591 | ||
596 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 592 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
597 | 593 | ||
598 | if (sta->txrate_idx < sband->n_bitrates) | 594 | rcu_read_lock(); |
595 | |||
596 | sta = sta_info_get(local, sdata->u.sta.bssid); | ||
597 | |||
598 | if (sta && sta->txrate_idx < sband->n_bitrates) | ||
599 | rate->value = sband->bitrates[sta->txrate_idx].bitrate; | 599 | rate->value = sband->bitrates[sta->txrate_idx].bitrate; |
600 | else | 600 | else |
601 | rate->value = 0; | 601 | rate->value = 0; |
602 | |||
603 | rcu_read_unlock(); | ||
604 | |||
605 | if (!sta) | ||
606 | return -ENODEV; | ||
607 | |||
602 | rate->value *= 100000; | 608 | rate->value *= 100000; |
603 | 609 | ||
604 | return 0; | 610 | return 0; |