Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4296320pxb; Mon, 1 Feb 2021 18:47:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqkkBLcrzpY0kUgUqOO9Injlmq7bKdQ92XvNSgsAv8VJ1wPzFv788VXfB7IaIFvEaqFagh X-Received: by 2002:a17:906:6a92:: with SMTP id p18mr19934125ejr.308.1612234024259; Mon, 01 Feb 2021 18:47:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612234024; cv=none; d=google.com; s=arc-20160816; b=muctNG/UVPNSD9XzB5V/MuMZCkphODHiodNPkE6PybnBDPJ7uCGznrH8iTs7oy4zW+ fX2QpmwhSBg44zc0Zgx3YcUpWPQeZMJ0WCYd0qXOsYYO1tisze3g1y3/ieLKQ1Cg/LG9 ku9+fh4eV5hlr9fq2hDVfPkAQHcztd35GwhPEZVWjhxz4lyFLJ4BxsnZaA3jrdqqQLrG M2ni2Spsxh1wKQP8mDDRH2yK8AIHHP3inTVi7wH7iHXPHaCsnTt+f1YGTuvM7IcuzIZ3 q0xIA1JxmvhwXwCGNwOu8bM70v4AvCEqE95SUlW1qZ0qiBe+pNtfDR/dw/1L+bmwCY8d Etfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=uITZIRq2V6q5qSCUOLhj43gM7pGs59qTkMOHdBiHBX8=; b=dh8H7wq0PpLKdbERWp790Nd0ifeUwTiVaFGcCFWh59iu2z/BG3atysBgAtQ4ts9NG7 GYUe9NRKLL4Nj11SBTjzU9WgRGP0d07Ys2Udao7UPAK5OnkdjSAae71+niKk8WRh091T vZXNGGZ+duZR9h/QBaQ++xtTsx0ILIxntN6T8M1SWSro6SQQfN3RrVeSwJwmK4kPh1Kd caublexkEv6GGowlxBKCAMKhpFjd/xivl7+PFpMeAGw50EnX8S7DLKrKZyog+0R0S3Uk 8U0fHwr6h5xsvfyNYg0jz+fpaoMUP8rVOdactJ7wFgmpdgTtV+4H+XxRD1Z1MlI7eTbx wXuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gY1tDyWF; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t9si4046233ejd.309.2021.02.01.18.46.28; Mon, 01 Feb 2021 18:47:04 -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=@google.com header.s=20161025 header.b=gY1tDyWF; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231469AbhBBCqC (ORCPT + 99 others); Mon, 1 Feb 2021 21:46:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231360AbhBBCp7 (ORCPT ); Mon, 1 Feb 2021 21:45:59 -0500 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 808ABC061573 for ; Mon, 1 Feb 2021 18:45:19 -0800 (PST) Received: by mail-qk1-x749.google.com with SMTP id e5so14853158qkn.2 for ; Mon, 01 Feb 2021 18:45:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=uITZIRq2V6q5qSCUOLhj43gM7pGs59qTkMOHdBiHBX8=; b=gY1tDyWFRuA+U5J8SpkhoZAtl/n+BQZ0jU2IUH2scTEb4ip7k5UGLfgxJPpv955Yu3 y+1YAECTkbOnp8JEoqqhASRyBzzArynhp12Ha0mMBwTAulG7q0SiqsKNpwNOOD1gddaR +3NFolkMuHoMwiU2oOe77Kbrf4ORhdry8Tmb87qBN8VFI25Z+ztQOnDjnwsDVyO2XZIa PdIu5rPupfsBdnOPTPIxXP4zgFFY4kxAJBU2Ce2cAald0Zko38i4vfzSermB9qxVK4QD I7b22E3s2HubXZwNk1x8oq+Mn5mOXth/A352X4mEm6lJfO8xOv7hSA/hBI+c3BsTEsU2 4NHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=uITZIRq2V6q5qSCUOLhj43gM7pGs59qTkMOHdBiHBX8=; b=syYXQYSNFCPD94xbSZPdAKUoiayvMnne5cX/y82DcgriaG8VvQMHnJADrcRvZvcmyp eQrMopuBgst90nmTUzIB9Cmtjn88n7YVpScg0ZVWEtjo7IFl6U0bHzRVOGRewiPImVFN Iob5kXANUc/K0NNEhEF4PlW1+11wD/YS4FHddGfhoBygxF0Ps03PqcgrjRMDkVSOE2gd 5gliXUofyZQtnGoG9irEnS1SUHnr35Z9/UMJHkFOPPD7kH7RejU58rBHsky21B0XpaWg nQC35r9YDFhtP58gai0Qk3+sj9Pq3bXne28K3NrSsOkcclr+0gXaISMQoCppfoVMoMxw 6iCA== X-Gm-Message-State: AOAM531KCDgXT06VmY+WSiIG2bicaDA3dmNFXZft589eEqJZ5vplzGax 5t42v8VklwTWw1Kfsd0yG+l09SaIU3rX Sender: "amistry via sendgmr" X-Received: from nandos.syd.corp.google.com ([2401:fa00:9:14:243a:8f72:7104:7a64]) (user=amistry job=sendgmr) by 2002:a0c:b912:: with SMTP id u18mr7724925qvf.2.1612233918714; Mon, 01 Feb 2021 18:45:18 -0800 (PST) Date: Tue, 2 Feb 2021 13:45:09 +1100 Message-Id: <20210202134451.1.I0d2e83c42755671b7143504b62787fd06cd914ed@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog Subject: [PATCH] ath10k: Fix suspicious RCU usage warning in ath10k_wmi_tlv_parse_peer_stats_info() From: Anand K Mistry To: ath10k@lists.infradead.org Cc: Anand K Mistry , "David S. Miller" , Jakub Kicinski , Kalle Valo , Wen Gong , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- 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 7b5834157fe5..e6135795719a 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.30.0.365.g02bc693789-goog