From patchwork Tue Jun 11 17:13:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Owens X-Patchwork-Id: 250578 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 50C4D2C008F for ; Wed, 12 Jun 2013 03:13:41 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755833Ab3FKRNX (ORCPT ); Tue, 11 Jun 2013 13:13:23 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:52436 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755712Ab3FKRNV (ORCPT ); Tue, 11 Jun 2013 13:13:21 -0400 Received: by mail-pd0-f172.google.com with SMTP id z10so5297980pdj.31 for ; Tue, 11 Jun 2013 10:13:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=sQDQJ0mA8QN43UIWofnilbpmT7bcdo2MM54Zwqn8eRs=; b=mbFz8ANexJaufdCzWhC28LSWOmm1BKbbxylEAmx2PkFPrmPl9/R5mb70MposLiQumv IDFFMUhlKTe0HkTG5nrx1n6uMZb2xRAEX2kunSWHcMl2LRNSRgjQu8hl5DAzl/0I9MmI hFYFp0j9nsakYUXtBkLHr4l2C0bzbYOdPn9s3w6xw3RXFMKkrujOWBtxZ4rUwe/yGh2f pC8Hd92gd9hirpHaChOG+VmF+a9OU3VqF5HLwjbExZCRbCWL3HS6x96qIhcm4gKCHEih KIm69FaUJ8KLueN3PvPZ8T9+0JRhpRMsP21xEF5pFlyOzBFCmVoxjFXmrOTYiPQrg1u7 ApgA== X-Received: by 10.68.88.129 with SMTP id bg1mr15623881pbb.10.1370970800891; Tue, 11 Jun 2013 10:13:20 -0700 (PDT) Received: from gmail.com ([32.149.180.176]) by mx.google.com with ESMTPSA id cc15sm20925635pac.1.2013.06.11.10.13.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 10:13:19 -0700 (PDT) Date: Tue, 11 Jun 2013 12:13:04 -0500 From: Calvin Owens To: Johannes Berg , "Luis R. Rodriguez" , "John W. Linville" , Felix Fietkau Cc: 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: ath9k: Use RCU protection calling ieee80211_get_tx_rates Message-ID: <20130611171304.GA2189@gmail.com> References: <20130609225120.GA2789@gmail.com> <20130610042959.GA1902@gmail.com> <1370950926.8356.14.camel@jlt4.sipsolutions.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1370950926.8356.14.camel@jlt4.sipsolutions.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Calvin Owens --- 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(-) 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.