From patchwork Wed Feb 10 00:42:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12079589 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BF98C433E9 for ; Wed, 10 Feb 2021 00:46:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B9C064D87 for ; Wed, 10 Feb 2021 00:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234519AbhBJAp4 (ORCPT ); Tue, 9 Feb 2021 19:45:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233588AbhBJAnW (ORCPT ); Tue, 9 Feb 2021 19:43:22 -0500 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68441C06178B for ; Tue, 9 Feb 2021 16:42:31 -0800 (PST) Received: by mail-ot1-x32f.google.com with SMTP id d7so279900otq.6 for ; Tue, 09 Feb 2021 16:42:31 -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=cI1Wn7QQuF0sK59lLixArXYXLfpnIwJV8oZPdAl0F9I=; b=DIvvnk6wC8ONJvFq9cTGdR3t5x/Tc4iGsaCj21MPN2ATDuZtlI7MnoRCkXsx8u/A6F XL71KEb2gHg8vMfwwrz1WlOqPT0W8csrMcnpvBDOGvQFyFYltgo08+oifi56gbd0Yh0b miKFg7PFvi0WjKFK4TORSVojMT39LF1llklBg= 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=cI1Wn7QQuF0sK59lLixArXYXLfpnIwJV8oZPdAl0F9I=; b=cKqYAd6sF2sot/LWxuJVe9vnSwb84mC6JawcHV71E8n30fto1sZxk9rkEFGHCmQRby OFa9jUGmePXUOSLYZXR+tF28dWdK1XtjYVHhrgKevBgzpns2vbBxxuKImbRO8aYH+INr gt7egw9bMYGI8hGpEiuRVaW/3aqSuHLgVAhbHxuw4jty4oQJI9E9B9jpfvHGT7XjBxHf DD/R5dDx/uxnIGyfwt1Hsq+G6M+R6iVhx0bgoUpKtDQh4vIxfahZrX6dk6v2uzrNi+l6 dhKpaZxDIYNrlwA7I5HtK+FrnZqLWhro9P30FRDXyXejHeGQV1HpzQyw/sP+ohB3WKV0 dYtQ== X-Gm-Message-State: AOAM532Rr+TxpSe8SfgNu6sDWj6DBrJnh2mT73bSLReuvJzkvRI2l/tF 6j2ywCRlz4NfP3XHmGbUJCKDSg== X-Google-Smtp-Source: ABdhPJzKQa0dSZJCF0TM5/ZcnkFLZt3bvK+BZ0jF/xZh3XELFHCeH3EjFvlM737bclqF5vunbMW+kw== X-Received: by 2002:a05:6830:573:: with SMTP id f19mr229610otc.117.1612917750861; Tue, 09 Feb 2021 16:42:30 -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 s123sm103060oos.3.2021.02.09.16.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 16:42:30 -0800 (PST) From: Shuah Khan To: kvalo@codeaurora.org, davem@davemloft.net, kuba@kernel.org Cc: Shuah Khan , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] ath10k: fix conf_mutex lock assert in ath10k_debug_fw_stats_request() Date: Tue, 9 Feb 2021 17:42:22 -0700 Message-Id: <1c38ef6d39ed89a564bc817d964d923ff0676c53.1612915444.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ath10k_debug_fw_stats_request() is called ath10k_sta_statistics() without holding conf_mutex. ath10k_debug_fw_stats_request() simply returns when CONFIG_ATH10K_DEBUGFS is disabled. When CONFIG_ATH10K_DEBUGFS is enabled, ath10k_debug_fw_stats_request() code path isn't protected. This assert is triggered when CONFIG_LOCKDEP and CONFIG_ATH10K_DEBUGFS are enabled. All other ath10k_debug_fw_stats_request() callers hold conf_mutex. Fix ath10k_sta_statistics() to do the same. WARNING: CPU: 5 PID: 696 at drivers/net/wireless/ath/ath10k/debug.c:357 ath10k_debug_fw_stats_request+0x29a/0x2d0 [ath10k_core] Modules linked in: rfcomm ccm fuse cmac algif_hash algif_skcipher af_alg bnep binfmt_misc nls_iso8859_1 intel_rapl_msr intel_rapl_common snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_hda_core snd_hwdep snd_pcm amdgpu snd_seq_midi snd_seq_midi_event snd_rawmidi edac_mce_amd snd_seq ath10k_pci ath10k_core aesni_intel gpu_sched drm_ttm_helper btusb ttm glue_helper crypto_simd btrtl ath cryptd drm_kms_helper snd_seq_device btbcm snd_timer rapl btintel cec i2c_algo_bit mac80211 bluetooth fb_sys_fops input_leds ecdh_generic snd wmi_bmof syscopyarea ecc serio_raw efi_pstore ccp k10temp sysfillrect soundcore sysimgblt snd_pci_acp3x cfg80211 ipmi_devintf libarc4 ipmi_msghandler mac_hid sch_fq_codel parport_pc ppdev lp parport drm ip_tables x_tables autofs4 hid_generic usbhid hid crc32_pclmul psmouse ahci nvme libahci i2c_piix4 nvme_core r8169 realtek wmi video CPU: 5 PID: 696 Comm: NetworkManager Tainted: G W 5.11.0-rc7+ #20 Hardware name: LENOVO 10VGCTO1WW/3130, BIOS M1XKT45A 08/21/2019 RIP: 0010:ath10k_debug_fw_stats_request+0x29a/0x2d0 [ath10k_core] Code: 83 c4 10 44 89 f8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 48 8d bf e8 20 00 00 be ff ff ff ff e8 de 2d 47 fa 85 c0 0f 85 8d fd ff ff <0f> 0b e9 86 fd ff ff 41 bf a1 ff ff ff 44 89 fa 48 c7 c6 2c 71 c4 RSP: 0018:ffffaffbc124b7d0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff93d02e4fec70 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffff93d00cba5248 RDI: ffff93d00ab309a0 RBP: ffffaffbc124b808 R08: 0000000000000000 R09: ffff93d02e4fec70 R10: 0000000000000001 R11: 0000000000000246 R12: ffff93d00cba3160 R13: ffff93d00cba3160 R14: ffff93d02e4fe4f0 R15: 0000000000000001 FS: 00007f7ce8d50bc0(0000) GS:ffff93d137d40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fc3595ad160 CR3: 000000010d492000 CR4: 00000000003506e0 Call Trace: ? sta_info_get_bss+0xeb/0x1f0 [mac80211] ath10k_sta_statistics+0x4f/0x280 [ath10k_core] sta_set_sinfo+0xda/0xd20 [mac80211] ieee80211_get_station+0x58/0x80 [mac80211] nl80211_get_station+0xbd/0x340 [cfg80211] genl_family_rcv_msg_doit+0xe7/0x150 genl_rcv_msg+0xe2/0x1e0 ? nl80211_dump_station+0x3a0/0x3a0 [cfg80211] ? nl80211_send_station+0xef0/0xef0 [cfg80211] ? genl_get_cmd+0xd0/0xd0 netlink_rcv_skb+0x55/0x100 genl_rcv+0x29/0x40 netlink_unicast+0x1a8/0x270 netlink_sendmsg+0x253/0x480 sock_sendmsg+0x65/0x70 ____sys_sendmsg+0x219/0x260 ? __import_iovec+0x32/0x170 ___sys_sendmsg+0xb7/0x100 ? end_opal_session+0x39/0xd0 ? __fget_files+0xe0/0x1d0 ? find_held_lock+0x31/0x90 ? __fget_files+0xe0/0x1d0 ? __fget_files+0x103/0x1d0 ? __fget_light+0x32/0x80 __sys_sendmsg+0x5a/0xa0 ? syscall_enter_from_user_mode+0x21/0x60 __x64_sys_sendmsg+0x1f/0x30 do_syscall_64+0x38/0x50 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f7cea2c791d Code: 28 89 54 24 1c 48 89 74 24 10 89 7c 24 08 e8 4a ee ff ff 8b 54 24 1c 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 33 44 89 c7 48 89 44 24 08 e8 9e ee ff ff 48 RSP: 002b:00007ffedf612a30 EFLAGS: 00000293 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00005618c4cfec00 RCX: 00007f7cea2c791d RDX: 0000000000000000 RSI: 00007ffedf612a80 RDI: 000000000000000b RBP: 00007ffedf612a80 R08: 0000000000000000 R09: 00005618c4e74000 R10: 00005618c4da0590 R11: 0000000000000293 R12: 00005618c4cfec00 R13: 00005618c4cfe2c0 R14: 00007f7cea32ef80 R15: 00005618c4cff340 irq event stamp: 520897 hardirqs last enabled at (520903): [] console_unlock+0x4e5/0x5d0 hardirqs last disabled at (520908): [] console_unlock+0x458/0x5d0 softirqs last enabled at (520722): [] asm_call_irq_on_stack+0x12/0x20 softirqs last disabled at (520717): [] asm_call_irq_on_stack+0x12/0x20 Signed-off-by: Shuah Khan --- drivers/net/wireless/ath/ath10k/mac.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 7d98250380ec..e815aab412d7 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -9117,7 +9117,9 @@ static void ath10k_sta_statistics(struct ieee80211_hw *hw, if (!ath10k_peer_stats_enabled(ar)) return; + mutex_lock(&ar->conf_mutex); ath10k_debug_fw_stats_request(ar); + mutex_unlock(&ar->conf_mutex); sinfo->rx_duration = arsta->rx_duration; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); From patchwork Wed Feb 10 00:42:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12079599 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29777C433DB for ; Wed, 10 Feb 2021 00:48:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5CD664E54 for ; Wed, 10 Feb 2021 00:48:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234737AbhBJAro (ORCPT ); Tue, 9 Feb 2021 19:47:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234472AbhBJApW (ORCPT ); Tue, 9 Feb 2021 19:45:22 -0500 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53CFBC061797 for ; Tue, 9 Feb 2021 16:42:34 -0800 (PST) Received: by mail-ot1-x32e.google.com with SMTP id c16so309754otp.0 for ; Tue, 09 Feb 2021 16:42:34 -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=z79ZGo6240pzhO2w017tO0EYbGsfaiPNtzjr+o4CyVs=; b=IzTLSvrpTU984HA6FPmdIzo9c6yUerDFYx83kwD6vDItCnWrzOaqUZxkMK4IpSWaRu X7ouFY7siJXiMCMfiq0Uyv7L12I1VKyxkPiMaRgpx8/WEPNACGL3zdhgYDftwC/uzMyY OA1xt8kCu8ptII2jy+Z3CIpBxzLL1s7XaMulQ= 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=z79ZGo6240pzhO2w017tO0EYbGsfaiPNtzjr+o4CyVs=; b=kgmQiJ6ZVnIlLdpayESFQ0qFdDNZUzoEF6elxEUuKEnJLuoiFzv8F0tmI43+UKd/wc 9IHxrJVFjWuRqsgIY2UDvYufo0OHyVKSmbtRf6ji7Q+pGzpfCDN4IdbXReUMLg0vjyy1 FT5iBnyNy3BbmwZ18zCjW+hZE6PneD+6PbtLwkwMOyZWIvMOBP0twWLKIM4CF0if5khl ewpaEAN31PF7APOA63Mkgdqbwf0RHmTECZH+oaDv92pNziG14LMrOh3SxAvt2uVB70kK P292wat93OTziOD5ZI05GlAbX07AJjF8T0oy4jSz/4/6EBpKyenzfgI+ZbVwDghQrcjE CK4w== X-Gm-Message-State: AOAM5336BXgmFveXZsMHGquwYASnymUP8barLDhE37Oeal7ymgX17fiY HPpTI6WQ893JvjV6UctR8YJtnw== X-Google-Smtp-Source: ABdhPJxB0TlZqQYNJ/niDq4cWTmLSxwTkRDSAQZFaHU3r9ztbpakBwJQt50GOVe3qiWjqQ1PoSba0g== X-Received: by 2002:a05:6830:1bc9:: with SMTP id v9mr259484ota.106.1612917752876; Tue, 09 Feb 2021 16:42:32 -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 s123sm103060oos.3.2021.02.09.16.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 16:42:32 -0800 (PST) From: Shuah Khan To: kvalo@codeaurora.org, davem@davemloft.net, kuba@kernel.org Cc: Shuah Khan , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] ath10k: fix WARNING: suspicious RCU usage Date: Tue, 9 Feb 2021 17:42:23 -0700 Message-Id: <23a1333dfb0367cc69e7177a2e373df0b6d42980.1612915444.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 ath10k_wmi_tlv_parse_peer_stats_info() to hold RCU lock before it calls ieee80211_find_sta_by_ifaddr() and release it when the resulting pointer is no longer needed. The log below shows the problem. While at it, fix ath10k_wmi_tlv_op_pull_peer_stats_info() to do the same. ============================= WARNING: suspicious RCU usage 5.11.0-rc7+ #20 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/5/44. stack backtrace: CPU: 5 PID: 44 Comm: ksoftirqd/5 Tainted: G W 5.11.0-rc7+ #20 Hardware name: LENOVO 10VGCTO1WW/3130, BIOS M1XKT45A 08/21/2019 Call Trace: dump_stack+0x7d/0x9f lockdep_rcu_suspicious+0xdb/0xe5 __rhashtable_lookup+0x1eb/0x260 [mac80211] ieee80211_find_sta_by_ifaddr+0x5b/0xc0 [mac80211] ath10k_wmi_tlv_parse_peer_stats_info+0x3e/0x90 [ath10k_core] ath10k_wmi_tlv_iter+0x6a/0xc0 [ath10k_core] ? ath10k_wmi_tlv_op_pull_mgmt_tx_bundle_compl_ev+0xe0/0xe0 [ath10k_core] ath10k_wmi_tlv_op_rx+0x5da/0xda0 [ath10k_core] ? trace_hardirqs_on+0x54/0xf0 ? ath10k_ce_completed_recv_next+0x4e/0x60 [ath10k_core] ath10k_wmi_process_rx+0x1d/0x40 [ath10k_core] ath10k_htc_rx_completion_handler+0x115/0x180 [ath10k_core] ath10k_pci_process_rx_cb+0x149/0x1b0 [ath10k_pci] ? ath10k_htc_process_trailer+0x2d0/0x2d0 [ath10k_core] ? ath10k_pci_sleep.part.0+0x6a/0x80 [ath10k_pci] ath10k_pci_htc_rx_cb+0x15/0x20 [ath10k_pci] ath10k_ce_per_engine_service+0x61/0x80 [ath10k_core] ath10k_ce_per_engine_service_any+0x7d/0xa0 [ath10k_core] ath10k_pci_napi_poll+0x48/0x120 [ath10k_pci] net_rx_action+0x136/0x500 __do_softirq+0xc6/0x459 ? smpboot_thread_fn+0x2b/0x1f0 run_ksoftirqd+0x2b/0x60 smpboot_thread_fn+0x116/0x1f0 kthread+0x14b/0x170 ? smpboot_register_percpu_thread+0xe0/0xe0 ? __kthread_bind_mask+0x70/0x70 ret_from_fork+0x22/0x30 Signed-off-by: Shuah Khan --- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index 7b5834157fe5..615157dd6866 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -225,6 +225,7 @@ static int ath10k_wmi_tlv_parse_peer_stats_info(struct ath10k *ar, u16 tag, u16 const struct wmi_tlv_peer_stats_info *stat = ptr; struct ieee80211_sta *sta; struct ath10k_sta *arsta; + int ret = 0; if (tag != WMI_TLV_TAG_STRUCT_PEER_STATS_INFO) return -EPROTO; @@ -240,10 +241,12 @@ 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) { ath10k_warn(ar, "not found station for peer stats\n"); - return -EINVAL; + ret = -EINVAL; + goto exit; } arsta = (struct ath10k_sta *)sta->drv_priv; @@ -252,7 +255,9 @@ static int ath10k_wmi_tlv_parse_peer_stats_info(struct ath10k *ar, u16 tag, u16 arsta->tx_rate_code = __le32_to_cpu(stat->last_tx_rate_code); arsta->tx_bitrate_kbps = __le32_to_cpu(stat->last_tx_bitrate_kbps); - return 0; +exit: + rcu_read_unlock(); + return ret; } static int ath10k_wmi_tlv_op_pull_peer_stats_info(struct ath10k *ar, @@ -573,13 +578,13 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb) case WMI_TDLS_TEARDOWN_REASON_TX: case WMI_TDLS_TEARDOWN_REASON_RSSI: case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT: + rcu_read_lock(); station = ieee80211_find_sta_by_ifaddr(ar->hw, ev->peer_macaddr.addr, NULL); if (!station) { ath10k_warn(ar, "did not find station from tdls peer event"); - kfree(tb); - return; + goto exit; } arvif = ath10k_get_arvif(ar, __le32_to_cpu(ev->vdev_id)); ieee80211_tdls_oper_request( @@ -590,6 +595,8 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb) ); break; } +exit: + rcu_read_unlock(); kfree(tb); } From patchwork Wed Feb 10 00:42:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12079597 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13949C433E6 for ; Wed, 10 Feb 2021 00:48:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C475E64E50 for ; Wed, 10 Feb 2021 00:48:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234606AbhBJAre (ORCPT ); Tue, 9 Feb 2021 19:47:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234470AbhBJApW (ORCPT ); Tue, 9 Feb 2021 19:45:22 -0500 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99547C0617A7 for ; Tue, 9 Feb 2021 16:42:35 -0800 (PST) Received: by mail-ot1-x32e.google.com with SMTP id e4so283365ote.5 for ; Tue, 09 Feb 2021 16:42:35 -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=4ZnFgpWZW/pibsdLxTLSbnISeByhzyHarQxXUqXKzeg=; b=hItZCUkUv3hVP0EKFKWGCHiq7LK6jTKvkwxQLRTVv+G2duyo63PGIc8YpI3DXE6v6Q 93/TWf1dv1X8blaa5DeXeJ06ryE89D1TQkJDMHeu8+4PcwShh/BskEUrk4FnAjGukA1/ b6mCu9NEcGcDsOJPB1nb3PYD86+w1ds5Zeedg= 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=4ZnFgpWZW/pibsdLxTLSbnISeByhzyHarQxXUqXKzeg=; b=NwL/1rES0wBhck3d7JhWddAqKZif+9lbJOrxcUBBtE1Bg+9JSYA7Nz1R5X19o6+AwH ud5IgUzdibKam48/s3kYgELBDZ13vgNPVTsDMciOb9OhxP6mrByikFN/tgrqeZdNFdZU SUYd6zVc9BJUgpGgsRNoeXt3g49z5bApixykxu1GtRcatTrhAdfMm+GpbHZt7mWW0V8J tmUKLbU2/VzAT6xVf+tUTcBJ+9EEn6Q3gcVaMfXc+BDB/QwX6wr+Rtlw+MYKpUHRyKTv 6Lge2HySRiOb3jAfbvjX9ze12KU/jcOLOxxOwfIC0iwVgOPRAzSQ+nzky8WKrRoaTTvV fQow== X-Gm-Message-State: AOAM531f9BjggwF663TmfmPeUhUBqQA9ZhG++9okY1Kicq3HH0WMJgTN 5wIFRrUJ2ZBsR/D+2PdfoK3HrA== X-Google-Smtp-Source: ABdhPJweKOk0U05wNNP7z8KOUn9C3PAmUn3jmo0QzHPBvGkR1giuIk30fNASdJrHyDRZtCLGpIiDCQ== X-Received: by 2002:a9d:4e2:: with SMTP id 89mr259973otm.140.1612917755107; Tue, 09 Feb 2021 16:42:35 -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 s123sm103060oos.3.2021.02.09.16.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 16:42:34 -0800 (PST) From: Shuah Khan To: kvalo@codeaurora.org, davem@davemloft.net, kuba@kernel.org Cc: Shuah Khan , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] ath10k: change ath10k_offchan_tx_work() peer present msg to a warn Date: Tue, 9 Feb 2021 17:42:24 -0700 Message-Id: <3b1f71272d56ee1d7f567fbce13bdb56cc06d342.1612915444.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Based on the comment block in this function and the FIXME for this, peer being present for the offchannel tx is unlikely. Peer is deleted once tx is complete. Change peer present msg to a warn to detect this condition. Signed-off-by: Shuah Khan --- drivers/net/wireless/ath/ath10k/mac.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index e815aab412d7..53f92945006f 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3954,9 +3954,8 @@ void ath10k_offchan_tx_work(struct work_struct *work) spin_unlock_bh(&ar->data_lock); if (peer) - /* FIXME: should this use ath10k_warn()? */ - ath10k_dbg(ar, ATH10K_DBG_MAC, "peer %pM on vdev %d already present\n", - peer_addr, vdev_id); + ath10k_warn(ar, "peer %pM on vdev %d already present\n", + peer_addr, vdev_id); if (!peer) { ret = ath10k_peer_create(ar, NULL, NULL, vdev_id, From patchwork Wed Feb 10 00:42:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12079601 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F964C433E6 for ; Wed, 10 Feb 2021 00:49:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09F3764E57 for ; Wed, 10 Feb 2021 00:49:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234257AbhBJAtB (ORCPT ); Tue, 9 Feb 2021 19:49:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233767AbhBJApw (ORCPT ); Tue, 9 Feb 2021 19:45:52 -0500 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F755C061356 for ; Tue, 9 Feb 2021 16:42:37 -0800 (PST) Received: by mail-oi1-x22d.google.com with SMTP id k25so161571oik.13 for ; Tue, 09 Feb 2021 16:42:37 -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=MVSZTT1h7rg/Bji9PEZgBTdOFc1Uv4h/Ji7bDyaOHUI=; b=b2vrzFxHfxSWjiku00Fz3a6ecUxKY3t2TA0ZzSD7MG6YCM8ajrR7O2gxN7GLKC0rrC FVbuFVlPE0yeTOQlclSOdWDAZdh2akjPV49OJuSExxHxugqDN4N8XLofPBw9tHtZ205Y S3uPZv6Ya+G7CILfj3nxGLLgYE/xenGdXkgrc= 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=MVSZTT1h7rg/Bji9PEZgBTdOFc1Uv4h/Ji7bDyaOHUI=; b=mrRmCyyl32VZjt7cEAaepkPAH34gVsDRcMdF6dYVkxOXkGkQJbE4WGK/iL3tT82w6l cXejo1JowuIhQ4is9nH8/hG/4unWatsu1Hj1degXI6seNy3FDdNJMaRrqWDw4olCTOEx f+GtJ3pfFH2PtqZXObsPY7TRBaL0gmwWc/wAHka+iIv27jzoCGeuo/5JJKYvElCjJr9x cQVmYl+2jVPp7p+J2WBlUr1LIOios2NPL+1d9Y2oPykULVtAU9xNWORmezGSE75R8EL+ OwYQGzYwoW9W1pOdv4DA34q8q/QpPG6bcnWoynC31zFOWWi3iZww/QnjPmL+irwSNlaR wdjA== X-Gm-Message-State: AOAM5309RcrX5i3ZMvMpQclZEPPCbsnDGcwqTHEjx14jntR7NUhtFJyW iWjM6UUZMnBOU9THVVWYB2n6ig== X-Google-Smtp-Source: ABdhPJzy8O/u6gQ1mql56Asz4MrIdqm2ujZLVWA9B95vdv7w6LIFLxn2QJpAEovPx21tylnZEk7yJA== X-Received: by 2002:aca:8d0:: with SMTP id 199mr294690oii.94.1612917756994; Tue, 09 Feb 2021 16:42:36 -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 s123sm103060oos.3.2021.02.09.16.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 16:42:36 -0800 (PST) From: Shuah Khan To: kvalo@codeaurora.org, davem@davemloft.net, kuba@kernel.org Cc: Shuah Khan , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] ath10k: detect conf_mutex held ath10k_drain_tx() calls Date: Tue, 9 Feb 2021 17:42:25 -0700 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ath10k_drain_tx() must not be called with conf_mutex held as workers can use that also. Add check to detect conf_mutex held calls. Signed-off-by: Shuah Khan Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/net/wireless/ath/ath10k/mac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 53f92945006f..3545ce7dce0a 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -4566,6 +4566,7 @@ static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, /* Must not be called with conf_mutex held as workers can use that also. */ void ath10k_drain_tx(struct ath10k *ar) { + WARN_ON(lockdep_is_held(&ar->conf_mutex)); /* make sure rcu-protected mac80211 tx path itself is drained */ synchronize_net(); From patchwork Wed Feb 10 00:42:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12079603 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62C8EC433E0 for ; Wed, 10 Feb 2021 00:49:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34DC264E56 for ; Wed, 10 Feb 2021 00:49:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233972AbhBJAt1 (ORCPT ); Tue, 9 Feb 2021 19:49:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234526AbhBJApx (ORCPT ); Tue, 9 Feb 2021 19:45:53 -0500 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EED5C061221 for ; Tue, 9 Feb 2021 16:42:39 -0800 (PST) Received: by mail-ot1-x32e.google.com with SMTP id i20so276915otl.7 for ; Tue, 09 Feb 2021 16:42:39 -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=lSxRQe0NkuXvIC4LukBFAaQnS+eadT8rfkVxfIWM+A0=; b=CALrMMBCEUbB8CMtagKUhuHyyPH7YzI4dGisIXZAIC0QFUvYm0rwn/tZPFXXErx5QM GP8j/k1nlTROOjPRVG3EoZbP3sg8sWz61Bu9aFzBxZw7XvaFI1lVTf1FeaXnSZri5hY8 qBhy39vwsrJqLSQLOVw+fq5m2l8KLvuKd+3Wo= 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=lSxRQe0NkuXvIC4LukBFAaQnS+eadT8rfkVxfIWM+A0=; b=Y+I//yLsnLFfsE0UkChapoSjF045YUyYlaGG2QrhjJUIi+FmMF/0/SB1lFLaWQ9M5I 1Cdf657Qm5RTIK6z5ybgjRXR7BCNuPYZVi0SEt1yK777j0cpk+DPEyWYAlXrmKn9wG2H brjD+Mllr2xCmklksAcJ3CpVymVsw9vueDKTtetmo+4K2sHLAtA2GxeQ6AHfhfxhMTuV MOsW271AYr/68twcZMsFvjCFoXR1k900glHlIuKxs7PAvR9zza6TEE1Veh9HQ/IhE4ia CH0g52HnlMORJxdaoGShe7qiByi/m3DvyGJT3ufW5FTHOH/KRYX0EjO0CFP46CXN9w5F qp2Q== X-Gm-Message-State: AOAM533FAIIf8g9Cv3PdAKJcoBJOavuNVDpNDWrb/SAjwRZrlHh3gFLF OIG/0DWquYOoov9Tlsr3kNu0IQ== X-Google-Smtp-Source: ABdhPJwhMYzaqq232uAzJkcr5mlDWVQmCT0WHImd9fGHVfEjYCTxeS0NBNDzY8hl72uY1rvdPGJLLA== X-Received: by 2002:a9d:6003:: with SMTP id h3mr243308otj.23.1612917758613; Tue, 09 Feb 2021 16:42:38 -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 s123sm103060oos.3.2021.02.09.16.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 16:42:38 -0800 (PST) From: Shuah Khan To: kvalo@codeaurora.org, davem@davemloft.net, kuba@kernel.org Cc: Shuah Khan , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] ath10k: reduce invalid ht params rate message noise Date: Tue, 9 Feb 2021 17:42:26 -0700 Message-Id: <76a816d983e6c4d636311738396f97971b5523fb.1612915444.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ath10k_mac_get_rate_flags_ht() floods dmesg with the following messages, when it fails to find a match for mcs=7 and rate=1440. supported_ht_mcs_rate_nss2: {7, {1300, 2700, 1444, 3000} } ath10k_pci 0000:02:00.0: invalid ht params rate 1440 100kbps nss 2 mcs 7 dev_warn_ratelimited() isn't helping the noise. Use dev_warn_once() instead. Signed-off-by: Shuah Khan --- drivers/net/wireless/ath/ath10k/mac.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 3545ce7dce0a..276321f0cfdd 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -8970,8 +8970,9 @@ static void ath10k_mac_get_rate_flags_ht(struct ath10k *ar, u32 rate, u8 nss, u8 *bw |= RATE_INFO_BW_40; *flags |= RATE_INFO_FLAGS_SHORT_GI; } else { - ath10k_warn(ar, "invalid ht params rate %d 100kbps nss %d mcs %d", - rate, nss, mcs); + dev_warn_once(ar->dev, + "invalid ht params rate %d 100kbps nss %d mcs %d", + rate, nss, mcs); } }