From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-oa0-f47.google.com ([209.85.219.47]:60405 "EHLO mail-oa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751923Ab3FLIAw (ORCPT ); Wed, 12 Jun 2013 04:00:52 -0400 Date: Wed, 12 Jun 2013 03:00:42 -0500 From: Calvin Owens To: Johannes Berg Cc: "Luis R. Rodriguez" , "John W. Linville" , Felix Fietkau , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, ath9k-devel@lists.ath9k.org, netdev@vger.kernel.org, jcalvinowens@gmail.com Subject: [PATCH] mac80211: Use RCU protection in ieee80211_get_tx_rates() Message-ID: <20130612080042.GA1695@gmail.com> (sfid-20130612_100112_118459_98A63BFE) References: <20130609225120.GA2789@gmail.com> <20130610042959.GA1902@gmail.com> <1370950926.8356.14.camel@jlt4.sipsolutions.net> <20130611171304.GA2189@gmail.com> <1370980523.8356.70.camel@jlt4.sipsolutions.net> <20130612075634.GA1649@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 In-Reply-To: <20130612075634.GA1649@gmail.com> Sender: linux-wireless-owner@vger.kernel.org List-ID: Copying the rate table should be done in an RCU read-side critical section. Signed-off-by: Calvin Owens --- net/mac80211/rate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index d3f414f..090d9b0 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c @@ -538,6 +538,8 @@ static void rate_control_fill_sta_table(struct ieee80211_sta *sta, struct ieee80211_sta_rates *ratetbl = NULL; int i; + rcu_read_lock(); + if (sta && !info->control.skip_table) ratetbl = rcu_dereference(sta->rates); @@ -566,6 +568,8 @@ static void rate_control_fill_sta_table(struct ieee80211_sta *sta, if (rates[i].idx < 0 || !rates[i].count) break; } + + rcu_read_unlock(); } static void rate_control_apply_mask(struct ieee80211_sub_if_data *sdata, -- 1.8.2.1