Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2619725pxb; Thu, 11 Feb 2021 18:14:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhKATaSD+44nsibADeXSMw+3CC/jZ85llKGFu7c3cbc4YgTvFjXymiVIT0VI+Sec3j6Xdl X-Received: by 2002:a17:906:c0cd:: with SMTP id bn13mr698612ejb.368.1613096065802; Thu, 11 Feb 2021 18:14:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613096065; cv=none; d=google.com; s=arc-20160816; b=qe7/3rUC/QZod6Aep5q6BLlRKRNKG6rp+qJ+iIl57afEu4u68NtI1N5nZwvovZNxqU LVDdtSXLiBCStvBkNPmiw09EIAz9gbqJYjayNpmltRXy/XLHV4MZ5clSm5Cxyn7n97kU kLY/vQ1R62nJOLmNoDlzcDNmkNjnN762kZijlDVW/ER64qWIxl6zxPyueOGpdZK6UbMF t2YErcaSH8Nls9lM2gAlJdZdzpydfqvBMZ/w/A9T4DcRij4t09jQk9UnbKBZCZXbzHa+ v+TYnIWS+4xvlGJUfu4irRHqetmaANuD5mSWjnbtM0OYkjkHGozKm65j1iPChR9fo+uf 4LhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KNCXIuhBf/yLZUR6g/Q3bWrDbjCkAY4sfEfqXAFf6ac=; b=TptR0xuDaTjP/sTtawrJzsBrvSfV3vFuqwtXSUosDW4COucWBAp53v49CSYPKakcoS 3+DZVtlP7u2/fW9EEFytRU9kAT8A9N+zsfJR8H5HlBnVwneF+u0CWJSdicf/VRbnNT30 gG7YgceO31j6m+5jUzyPc/jWDa7Th+oPxwOx/vpsVmUYZhkH9H25S+/Bi3IO2yRDWfAj kx/kG79XtNsmn0lFxQfsbwNEB3Bda89dAm68dDETTMSwjC2SZzYm9vQva4HAvlnKBJzn /vSLUdSirUjHfct0/AtItMNARWBE51iZ3gxTafSGyX8ByEYe0W12WQQ4S273GVdzzjF3 1L9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=PwLlHkN9; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si5529904edc.273.2021.02.11.18.14.00; Thu, 11 Feb 2021 18:14:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=PwLlHkN9; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229675AbhBLCNy (ORCPT + 99 others); Thu, 11 Feb 2021 21:13:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbhBLCNx (ORCPT ); Thu, 11 Feb 2021 21:13:53 -0500 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68C44C061574 for ; Thu, 11 Feb 2021 18:13:13 -0800 (PST) Received: by mail-io1-xd33.google.com with SMTP id e133so7833284iof.8 for ; Thu, 11 Feb 2021 18:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KNCXIuhBf/yLZUR6g/Q3bWrDbjCkAY4sfEfqXAFf6ac=; b=PwLlHkN9fXZfpRWioXDoeeGXdYYWvqi46HIRhejT36qNkWkJyGKc4zk3p0GOfmzgr6 Q/r+kYD7SMKLoFSi2dITxN9BC40NtITXEhxpXIFZ7jEQw+fgXpFsRrgxKaxo8EMxO880 LfoxXYyzUgNNBgbgBxSnjPtjJfglTE2CrxRr4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KNCXIuhBf/yLZUR6g/Q3bWrDbjCkAY4sfEfqXAFf6ac=; b=t0ivYE8SxPIdeKx2t6UG4/IdhsptLf1l9ev1IQP2pviRUTqEqe8A3z9hBGpKo1PKFT jO9SS5WG9nMhnDuejGM30wbrSqF67/ZLHHGmvV3jomM4ZVs90GW6TEprYAUDzmvoc87j hq4pmyGhqodDSFzHFsG+1lzQKawA50BJRz21AAGm/YSKaNlLxLM3e63YUSqU7lc6IZgI KiPzNebD4rom0FHvy06UTdvc7gtnDwIde6Xil6xgD/rR3eWM/41tvPje7JFTBzXJ2AGu 7TJRisRgp3t+54z8c9+sxrOg2PZg8SWNqVvLv2kbDGpmr/T3TPrtH6y3Cqidxo1u5ecL W7PQ== X-Gm-Message-State: AOAM53010er1p+ATCKy901PCX/M0YUPN06WLiEfADpHR86fLRPCHdz1b DRDMWcdcEDMZByuBTUbusRj6tA== X-Received: by 2002:a05:6602:2c4e:: with SMTP id x14mr548974iov.58.1613095992862; Thu, 11 Feb 2021 18:13:12 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id c2sm3480594ilk.32.2021.02.11.18.13.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 18:13:12 -0800 (PST) From: Shuah Khan To: kvalo@codeaurora.org, davem@davemloft.net, kuba@kernel.org Cc: Shuah Khan , ath9k-devel@qca.qualcomm.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] ath9k: hold RCU lock when calling ieee80211_find_sta_by_ifaddr() Date: Thu, 11 Feb 2021 19:13:05 -0700 Message-Id: <1cfa036227cfa9fdd04316c01e1d754f13a70d9e.1613090339.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org ieee80211_find_sta_by_ifaddr() must be called under the RCU lock and the resulting pointer is only valid under RCU lock as well. Fix ath_tx_process_buffer() to hold RCU read lock before it calls ieee80211_find_sta_by_ifaddr() and release it when the resulting pointer is no longer needed. This problem was found while reviewing code to debug RCU warn from ath10k_wmi_tlv_parse_peer_stats_info() and a subsequent manual audit of other callers of ieee80211_find_sta_by_ifaddr() that don't hold RCU read lock. Signed-off-by: Shuah Khan --- - Note: This patch is compile tested. I don't have access to hardware. drivers/net/wireless/ath/ath9k/xmit.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index e60d4737fc6e..1d36aae3f7b6 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -701,6 +701,9 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, ts->ts_rateindex); hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; + + rcu_read_lock(); + sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2); if (sta) { struct ath_node *an = (struct ath_node *)sta->drv_priv; @@ -725,6 +728,8 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, if (!flush) ath_txq_schedule(sc, txq); + + rcu_read_unlock(); } static bool ath_lookup_legacy(struct ath_buf *bf) -- 2.27.0