Message ID | 20210202134451.1.I0d2e83c42755671b7143504b62787fd06cd914ed@changeid (mailing list archive) |
---|---|
State | Awaiting Upstream |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ath10k: Fix suspicious RCU usage warning in ath10k_wmi_tlv_parse_peer_stats_info() | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
Anand K Mistry <amistry@google.com> wrote: > 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 <amistry@google.com> > Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Patch applied to ath-next branch of ath.git, thanks. 2615e3cdbd9c ath10k: Fix suspicious RCU usage warning in ath10k_wmi_tlv_parse_peer_stats_info()
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; }
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 <amistry@google.com> --- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 3 +++ 1 file changed, 3 insertions(+)