Message ID | 20130611171304.GA2189@gmail.com |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
Now the subject should no longer say "mac80211:" :) However... given that ieee80211_get_tx_rates() actually *copies* the rates into the parameter, I guess it should do the rcu_read_lock() internally. I guess I wasn't paying attention previously. Felix? johannes -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Johannes Berg <johannes@sipsolutions.net> writes:
> Now the subject should no longer say "mac80211:" :)
It did have a change to mac80211.h as well, but IMHO that should be in a
separate patch.
On Tuesday 06/11 at 21:55 +0200, Johannes Berg wrote: > Now the subject should no longer say "mac80211:" :) > > However... given that ieee80211_get_tx_rates() actually *copies* the > rates into the parameter, I guess it should do the rcu_read_lock() > internally. I guess I wasn't paying attention previously. Felix? I thought about that, but it seemed too simple, so I assumed I was missing something. ;) I'll send a patch per above. That makes the header file update unnecessary too. > johannes -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 1c9b1ba..1d57015 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -142,8 +142,10 @@ static void ath_send_bar(struct ath_atx_tid *tid, u16 seqno) static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ath_buf *bf) { + rcu_read_lock(); ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates, ARRAY_SIZE(bf->rates)); + rcu_read_unlock(); } static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index cb34c78..468a5a6 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -900,9 +900,11 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw, hwsim_check_sta_magic(control->sta); if (rctbl) + rcu_read_lock(); ieee80211_get_tx_rates(txi->control.vif, control->sta, skb, txi->control.rates, ARRAY_SIZE(txi->control.rates)); + rcu_read_unlock(); txi->rate_driver_data[0] = channel; mac80211_hwsim_monitor_rx(hw, skb, channel); @@ -1008,9 +1010,11 @@ static void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, if (rctbl) { struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb); + rcu_read_lock(); ieee80211_get_tx_rates(txi->control.vif, NULL, skb, txi->control.rates, ARRAY_SIZE(txi->control.rates)); + rcu_read_unlock(); } mac80211_hwsim_monitor_rx(hw, skb, chan); @@ -1044,9 +1048,11 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, return; info = IEEE80211_SKB_CB(skb); if (rctbl) + rcu_read_lock(); ieee80211_get_tx_rates(vif, NULL, skb, info->control.rates, ARRAY_SIZE(info->control.rates)); + rcu_read_unlock(); txrate = ieee80211_get_tx_rate(hw, info); diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 885898a..df345c1 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -3175,7 +3175,8 @@ void ieee80211_sta_set_buffered(struct ieee80211_sta *sta, * * Call this function in a driver with per-packet rate selection support * to combine the rate info in the packet tx info with the most recent - * rate selection table for the station entry. + * rate selection table for the station entry. Must be called with RCU + * protection. * * @vif: &struct ieee80211_vif pointer from the add_interface callback. * @sta: the receiver station to which this packet is sent.
Signed-off-by: Calvin Owens <jcalvinowens@gmail.com> --- drivers/net/wireless/ath/ath9k/xmit.c | 2 ++ drivers/net/wireless/mac80211_hwsim.c | 6 ++++++ include/net/mac80211.h | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-)