Commit eee645ec authored by Baochen Qiang's avatar Baochen Qiang Committed by Kalle Valo

ath11k: Don't use GFP_KERNEL in atomic context

We are seeing below warning:
...
kernel: [ 5720.362941] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:197
kernel: [ 5720.362943] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/4
kernel: [ 5720.362947] CPU: 4 PID: 0 Comm: swapper/4 Tainted: G        W         5.10.90 #18 4fa489e3e5c16043994f416310c2f60eff666320
kernel: [ 5720.362949] Hardware name: Google Nipperkin/Nipperkin, BIOS Google_Nipperkin.14316.0.0 10/30/2021
kernel: [ 5720.362950] Call Trace:
kernel: [ 5720.362953]  <IRQ>
kernel: [ 5720.362959]  dump_stack+0x9c/0xe7
kernel: [ 5720.362964]  ___might_sleep+0x14a/0x160
kernel: [ 5720.362967]  kmem_cache_alloc+0x46/0x226
kernel: [ 5720.362970]  ? __alloc_skb+0x6c/0x19e
kernel: [ 5720.362972]  __alloc_skb+0x6c/0x19e
kernel: [ 5720.362985]  cfg80211_gtk_rekey_notify+0xa2/0x21d [cfg80211 2c8b5aee0416e7d010d70c332a47990fc843c1c5]
kernel: [ 5720.362995]  ath11k_wmi_gtk_offload_status_event+0x102/0x155 [ath11k 4c6bb5f7331c81199d56a7e37bdc10030f167838]
kernel: [ 5720.363002]  ath11k_wmi_tlv_op_rx+0x301/0x51b [ath11k 4c6bb5f7331c81199d56a7e37bdc10030f167838]
kernel: [ 5720.363009]  ath11k_htc_rx_completion_handler+0xee/0x3f5 [ath11k 4c6bb5f7331c81199d56a7e37bdc10030f167838]
kernel: [ 5720.363017]  ath11k_ce_per_engine_service+0x2aa/0x32c [ath11k 4c6bb5f7331c81199d56a7e37bdc10030f167838]
kernel: [ 5720.363024]  ath11k_pci_ce_tasklet+0x1a/0x30 [ath11k_pci 9acc399855ea172aa14a892c0bfdba0ce22d6f07]
kernel: [ 5720.363028]  tasklet_action_common+0x8d/0x9f
kernel: [ 5720.363032]  __do_softirq+0x163/0x29a
kernel: [ 5720.363035]  asm_call_irq_on_stack+0x12/0x20
kernel: [ 5720.363037]  </IRQ>
kernel: [ 5720.363041]  do_softirq_own_stack+0x3c/0x48
kernel: [ 5720.363043]  __irq_exit_rcu+0x9b/0x9d
kernel: [ 5720.363046]  common_interrupt+0xc9/0x14d
kernel: [ 5720.363049]  asm_common_interrupt+0x1e/0x40
kernel: [ 5720.363054] RIP: 0010:cpuidle_enter_state+0x1c5/0x2ac
kernel: [ 5720.363056] Code: 84 f6 4c 8b 75 c0 74 1e 48 c7 45 c8 00 00 00 00 9c 8f 45 c8 0f ba 65 c8 09 0f 82 d1 00 00 00 31 ff e8 4a bb 6c ff fb 45 85 e4 <78> 47 44 89 e0 48 6b d0 68 49 8b 4c 16 48 48 2b 5d b8 49 89 5d 18
kernel: [ 5720.363058] RSP: 0018:ffffa7e640157e78 EFLAGS: 00000206
kernel: [ 5720.363060] RAX: ffff9807ddf29b40 RBX: 00000533e033584c RCX: 00000533e033584c
kernel: [ 5720.363062] RDX: 0000000000000004 RSI: 0000000000000000 RDI: 0000000000000000
kernel: [ 5720.363063] RBP: ffffa7e640157ec0 R08: 0000000000000002 R09: 00000533e171bb7a
kernel: [ 5720.363064] R10: 0000000000000900 R11: fffffffffffffffe R12: 0000000000000003
kernel: [ 5720.363065] R13: ffff9804c2ef6000 R14: ffffffffbe9a7bd0 R15: 0000000000000003
kernel: [ 5720.363069]  ? cpuidle_enter_state+0x19a/0x2ac
kernel: [ 5720.363072]  cpuidle_enter+0x2e/0x3d
kernel: [ 5720.363074]  do_idle+0x163/0x1ee
kernel: [ 5720.363076]  cpu_startup_entry+0x1d/0x1f
kernel: [ 5720.363078]  secondary_startup_64_no_verify+0xb1/0xbb
...

This is because GFP_KERNEL is used by ath11k_wmi_gtk_offload_status_event
while in atomic context. Fix it by using GFP_ATOMIC instead.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3

Fixes: a16d9b50 ("ath11k: support GTK rekey offload")
Signed-off-by: default avatarBaochen Qiang <quic_bqiang@quicinc.com>
Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220427120033.1046759-1-quic_bqiang@quicinc.com
parent b72a4aff
...@@ -7844,7 +7844,7 @@ static void ath11k_wmi_gtk_offload_status_event(struct ath11k_base *ab, ...@@ -7844,7 +7844,7 @@ static void ath11k_wmi_gtk_offload_status_event(struct ath11k_base *ab,
replay_ctr_be = cpu_to_be64(replay_ctr); replay_ctr_be = cpu_to_be64(replay_ctr);
ieee80211_gtk_rekey_notify(arvif->vif, arvif->bssid, ieee80211_gtk_rekey_notify(arvif->vif, arvif->bssid,
(void *)&replay_ctr_be, GFP_KERNEL); (void *)&replay_ctr_be, GFP_ATOMIC);
kfree(tb); kfree(tb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment