Skip to content

Commit d4ba1ff

Browse files
jhovoldkvalo
authored andcommitted
ath11k: fix netdev open race
Make sure to allocate resources needed before registering the device. This specifically avoids having a racing open() trigger a BUG_ON() in mod_timer() when ath11k_mac_op_start() is called before the mon_reap_timer as been set up. I did not see this issue with next-20220310, but I hit it on every probe with next-20220511. Perhaps some timing changed in between. Here's the backtrace: [ 51.346947] kernel BUG at kernel/time/timer.c:990! [ 51.346958] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ... [ 51.578225] Call trace: [ 51.583293] __mod_timer+0x298/0x390 [ 51.589518] mod_timer+0x14/0x20 [ 51.595368] ath11k_mac_op_start+0x41c/0x4a0 [ath11k] [ 51.603165] drv_start+0x38/0x60 [mac80211] [ 51.610110] ieee80211_do_open+0x29c/0x7d0 [mac80211] [ 51.617945] ieee80211_open+0x60/0xb0 [mac80211] [ 51.625311] __dev_open+0x100/0x1c0 [ 51.631420] __dev_change_flags+0x194/0x210 [ 51.638214] dev_change_flags+0x24/0x70 [ 51.644646] do_setlink+0x228/0xdb0 [ 51.650723] __rtnl_newlink+0x460/0x830 [ 51.657162] rtnl_newlink+0x4c/0x80 [ 51.663229] rtnetlink_rcv_msg+0x124/0x390 [ 51.669917] netlink_rcv_skb+0x58/0x130 [ 51.676314] rtnetlink_rcv+0x18/0x30 [ 51.682460] netlink_unicast+0x250/0x310 [ 51.688960] netlink_sendmsg+0x19c/0x3e0 [ 51.695458] ____sys_sendmsg+0x220/0x290 [ 51.701938] ___sys_sendmsg+0x7c/0xc0 [ 51.708148] __sys_sendmsg+0x68/0xd0 [ 51.714254] __arm64_sys_sendmsg+0x28/0x40 [ 51.720900] invoke_syscall+0x48/0x120 Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 Fixes: d5c6515 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Fixes: 840c36f ("ath11k: dp: stop rx pktlog before suspend") Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2be8afe commit d4ba1ff

File tree

1 file changed

+8
-8
lines changed
  • drivers/net/wireless/ath/ath11k

1 file changed

+8
-8
lines changed

drivers/net/wireless/ath/ath11k/core.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,23 +1225,23 @@ static int ath11k_core_pdev_create(struct ath11k_base *ab)
12251225
return ret;
12261226
}
12271227

1228-
ret = ath11k_mac_register(ab);
1228+
ret = ath11k_dp_pdev_alloc(ab);
12291229
if (ret) {
1230-
ath11k_err(ab, "failed register the radio with mac80211: %d\n", ret);
1230+
ath11k_err(ab, "failed to attach DP pdev: %d\n", ret);
12311231
goto err_pdev_debug;
12321232
}
12331233

1234-
ret = ath11k_dp_pdev_alloc(ab);
1234+
ret = ath11k_mac_register(ab);
12351235
if (ret) {
1236-
ath11k_err(ab, "failed to attach DP pdev: %d\n", ret);
1237-
goto err_mac_unregister;
1236+
ath11k_err(ab, "failed register the radio with mac80211: %d\n", ret);
1237+
goto err_dp_pdev_free;
12381238
}
12391239

12401240
ret = ath11k_thermal_register(ab);
12411241
if (ret) {
12421242
ath11k_err(ab, "could not register thermal device: %d\n",
12431243
ret);
1244-
goto err_dp_pdev_free;
1244+
goto err_mac_unregister;
12451245
}
12461246

12471247
ret = ath11k_spectral_init(ab);
@@ -1254,10 +1254,10 @@ static int ath11k_core_pdev_create(struct ath11k_base *ab)
12541254

12551255
err_thermal_unregister:
12561256
ath11k_thermal_unregister(ab);
1257-
err_dp_pdev_free:
1258-
ath11k_dp_pdev_free(ab);
12591257
err_mac_unregister:
12601258
ath11k_mac_unregister(ab);
1259+
err_dp_pdev_free:
1260+
ath11k_dp_pdev_free(ab);
12611261
err_pdev_debug:
12621262
ath11k_debugfs_pdev_destroy(ab);
12631263

0 commit comments

Comments
 (0)