Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4010143pxb; Tue, 2 Mar 2021 04:36:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuLiz26ShYvSCkP0JQOcR3pcrW6DIZiayHazqlmiH/4H9ybU8PRP+kjUuA2ykvRjVlrpQW X-Received: by 2002:a17:906:2bce:: with SMTP id n14mr19868978ejg.171.1614688617731; Tue, 02 Mar 2021 04:36:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614688617; cv=none; d=google.com; s=arc-20160816; b=ZU/3X3ouV05kQGOe4fQRsTzXQ2HBgpkk64BwoHkAGrChrc+ahYPfTVtt7yyyWsInkI i3ef7/IikF2g9USJYyiyV16AGI4blpzO77s4+HmUEF+6uE2X2vQRx6KHV8AU1kPM+c49 e72mTud0rOachtVpMoS9b+G42k7+VDCpYgAhw65CcfMvbGZOjMO7P79wvWK1Ny/s7a+h ZSlwPpRi4Tqf3fidNUIzi8NI6g9myJFC/YZPGqvVMKvOepkSgcQHODifSVgY9g576CZl X+nZiKqAz6YCO/tYm+VzyJcX3SsAvTdgP7plrSRKCjubcSa7gtVFVxIYH4gh3TGwvA50 yiJQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZFpWHrXUAQIGmMQmT7vvl9l1lRDeomrfxfcIM+Imwfg=; b=HPSKeQ9WGJROKX/2EylRcjAEt6bzkjk5OHdavCxpR6Sg9HFl9dd3bQP1hnJGpndmLZ Vru1p/u5LgBNgTFrf+k1Eu39Dj7tbHxn03atl5rVF+NckSzlN7Mwxj1cwgvL784IVX59 2zILsjN7HGL0XlFldIfTUlH/57ae/Oa9mVWaOV4UWUqgYazucEfo/KnQHATgLVJwq/uk M7DnIhNElEjIz9vaIbgmvEHeBYSWFa1kI8yusxI79Ssaqihyus8H1sRsV0MloFeDYaIz cPsis3Us7JwrmvLIezYSv/hGPaS4G6MWkXxtfUQqctN3zy/C9qx70PLGie2vVFUkVasJ 2zuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gIQjcNbA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 m2si2144897edr.104.2021.03.02.04.36.33; Tue, 02 Mar 2021 04:36:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=korg header.b=gIQjcNbA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1442932AbhCBCRD (ORCPT + 99 others); Mon, 1 Mar 2021 21:17:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:53652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242277AbhCAToU (ORCPT ); Mon, 1 Mar 2021 14:44:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DB4C864FFA; Mon, 1 Mar 2021 17:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618428; bh=nxb7H9kc46wHw88pBK02xc8xUguiYxOFbqNehu6OHrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gIQjcNbAihdjuRJsVyrdHXWnCHft32mkdOZ8OY5gNxzOuUSY2xLvNWF0WyQ65KjGr VxjiKOFveKIHG39mXte8tCNab5Q3yeDphEpF/2lUlsvVO28RtIIf0s9nte/y4el1ye PZNQeYcR/EFDCVRE7KBb0KvWCg7fVIibWCdVtQjs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anand K Mistry , Kalle Valo , Sasha Levin Subject: [PATCH 5.10 083/663] ath10k: Fix suspicious RCU usage warning in ath10k_wmi_tlv_parse_peer_stats_info() Date: Mon, 1 Mar 2021 17:05:31 +0100 Message-Id: <20210301161145.839231299@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anand K Mistry [ Upstream commit 2615e3cdbd9c0e864f5906279c952a309871d225 ] The ieee80211_find_sta_by_ifaddr call in ath10k_wmi_tlv_parse_peer_stats_info must be called while holding the RCU read lock. Otherwise, the following warning will be seen when RCU usage checking is enabled: ============================= WARNING: suspicious RCU usage 5.10.3 #8 Tainted: G W ----------------------------- include/linux/rhashtable.h:594 suspicious rcu_dereference_check() usage! other info that might help us debug this: rcu_scheduler_active = 2, debug_locks = 1 no locks held by ksoftirqd/1/16. stack backtrace: CPU: 1 PID: 16 Comm: ksoftirqd/1 Tainted: G W 5.10.3 #8 Hardware name: HP Grunt/Grunt, BIOS Google_Grunt.11031.104.0 09/05/2019 Call Trace: dump_stack+0xab/0x115 sta_info_hash_lookup+0x71/0x1e9 [mac80211] ? lock_is_held_type+0xe6/0x12f ? __kasan_kmalloc+0xfb/0x112 ieee80211_find_sta_by_ifaddr+0x12/0x61 [mac80211] ath10k_wmi_tlv_parse_peer_stats_info+0xbd/0x10b [ath10k_core] ath10k_wmi_tlv_iter+0x8b/0x1a1 [ath10k_core] ? ath10k_wmi_tlv_iter+0x1a1/0x1a1 [ath10k_core] ath10k_wmi_tlv_event_peer_stats_info+0x103/0x13b [ath10k_core] ath10k_wmi_tlv_op_rx+0x722/0x80d [ath10k_core] ath10k_htc_rx_completion_handler+0x16e/0x1d7 [ath10k_core] ath10k_pci_process_rx_cb+0x116/0x22c [ath10k_pci] ? ath10k_htc_process_trailer+0x332/0x332 [ath10k_core] ? _raw_spin_unlock_irqrestore+0x34/0x61 ? lockdep_hardirqs_on+0x8e/0x12e ath10k_ce_per_engine_service+0x55/0x74 [ath10k_core] ath10k_ce_per_engine_service_any+0x76/0x84 [ath10k_core] ath10k_pci_napi_poll+0x49/0x141 [ath10k_pci] net_rx_action+0x11a/0x347 __do_softirq+0x2d3/0x539 run_ksoftirqd+0x4b/0x86 smpboot_thread_fn+0x1d0/0x2ab ? cpu_report_death+0x7f/0x7f kthread+0x189/0x191 ? cpu_report_death+0x7f/0x7f ? kthread_blkcg+0x31/0x31 ret_from_fork+0x22/0x30 Fixes: 0f7cb26830a6e ("ath10k: add rx bitrate report for SDIO") Signed-off-by: Anand K Mistry Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20210202134451.1.I0d2e83c42755671b7143504b62787fd06cd914ed@changeid Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index 7b5834157fe51..e6135795719a1 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -240,8 +240,10 @@ static int ath10k_wmi_tlv_parse_peer_stats_info(struct ath10k *ar, u16 tag, u16 __le32_to_cpu(stat->last_tx_rate_code), __le32_to_cpu(stat->last_tx_bitrate_kbps)); + rcu_read_lock(); sta = ieee80211_find_sta_by_ifaddr(ar->hw, stat->peer_macaddr.addr, NULL); if (!sta) { + rcu_read_unlock(); ath10k_warn(ar, "not found station for peer stats\n"); return -EINVAL; } @@ -251,6 +253,7 @@ static int ath10k_wmi_tlv_parse_peer_stats_info(struct ath10k *ar, u16 tag, u16 arsta->rx_bitrate_kbps = __le32_to_cpu(stat->last_rx_bitrate_kbps); arsta->tx_rate_code = __le32_to_cpu(stat->last_tx_rate_code); arsta->tx_bitrate_kbps = __le32_to_cpu(stat->last_tx_bitrate_kbps); + rcu_read_unlock(); return 0; } -- 2.27.0