Skip to content

Commit d19bac3

Browse files
committed
wifi: mac80211: don't WARN for late channel/color switch
There's really no value in the WARN stack trace etc., the reason for this happening isn't directly related to the calling function anyway. Also, syzbot has been observing it constantly, and there's no way we can resolve it there - those systems are just slow. Instead print an error message (once) and add a comment about what really causes this message. Reported-by: syzbot+468656785707b0e995df@syzkaller.appspotmail.com Reported-by: syzbot+18c783c5cf6a781e3e2c@syzkaller.appspotmail.com Reported-by: syzbot+d5924d5cffddfccab68e@syzkaller.appspotmail.com Reported-by: syzbot+7d73d99525d1ff7752ef@syzkaller.appspotmail.com Reported-by: syzbot+8e6e002c74d1927edaf5@syzkaller.appspotmail.com Reported-by: syzbot+97254a3b10c541879a65@syzkaller.appspotmail.com Reported-by: syzbot+dfd1fd46a1960ad9c6ec@syzkaller.appspotmail.com Reported-by: syzbot+85e0b8d12d9ca877d806@syzkaller.appspotmail.com Link: https://patch.msgid.link/20250617104902.146e10919be1.I85f352ca4a2dce6f556e5ff45ceaa5f3769cb5ce@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent d1b1a5e commit d19bac3

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

net/mac80211/debug.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
/*
33
* Portions
4-
* Copyright (C) 2022 - 2024 Intel Corporation
4+
* Copyright (C) 2022 - 2025 Intel Corporation
55
*/
66
#ifndef __MAC80211_DEBUG_H
77
#define __MAC80211_DEBUG_H
8+
#include <linux/once_lite.h>
89
#include <net/cfg80211.h>
910

1011
#ifdef CONFIG_MAC80211_OCB_DEBUG
@@ -152,6 +153,8 @@ do { \
152153
else \
153154
_sdata_err((link)->sdata, fmt, ##__VA_ARGS__); \
154155
} while (0)
156+
#define link_err_once(link, fmt, ...) \
157+
DO_ONCE_LITE(link_err, link, fmt, ##__VA_ARGS__)
155158
#define link_id_info(sdata, link_id, fmt, ...) \
156159
do { \
157160
if (ieee80211_vif_is_mld(&sdata->vif)) \

net/mac80211/tx.c

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
66
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
77
* Copyright 2013-2014 Intel Mobile Communications GmbH
8-
* Copyright (C) 2018-2024 Intel Corporation
8+
* Copyright (C) 2018-2025 Intel Corporation
99
*
1010
* Transmit and frame generation functions.
1111
*/
@@ -5016,12 +5016,25 @@ static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata,
50165016
}
50175017
}
50185018

5019-
static u8 __ieee80211_beacon_update_cntdwn(struct beacon_data *beacon)
5019+
static u8 __ieee80211_beacon_update_cntdwn(struct ieee80211_link_data *link,
5020+
struct beacon_data *beacon)
50205021
{
5021-
beacon->cntdwn_current_counter--;
5022+
if (beacon->cntdwn_current_counter == 1) {
5023+
/*
5024+
* Channel switch handling is done by a worker thread while
5025+
* beacons get pulled from hardware timers. It's therefore
5026+
* possible that software threads are slow enough to not be
5027+
* able to complete CSA handling in a single beacon interval,
5028+
* in which case we get here. There isn't much to do about
5029+
* it, other than letting the user know that the AP isn't
5030+
* behaving correctly.
5031+
*/
5032+
link_err_once(link,
5033+
"beacon TX faster than countdown (channel/color switch) completion\n");
5034+
return 0;
5035+
}
50225036

5023-
/* the counter should never reach 0 */
5024-
WARN_ON_ONCE(!beacon->cntdwn_current_counter);
5037+
beacon->cntdwn_current_counter--;
50255038

50265039
return beacon->cntdwn_current_counter;
50275040
}
@@ -5052,7 +5065,7 @@ u8 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif, unsigned int link_i
50525065
if (!beacon)
50535066
goto unlock;
50545067

5055-
count = __ieee80211_beacon_update_cntdwn(beacon);
5068+
count = __ieee80211_beacon_update_cntdwn(link, beacon);
50565069

50575070
unlock:
50585071
rcu_read_unlock();
@@ -5450,7 +5463,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,
54505463

54515464
if (beacon->cntdwn_counter_offsets[0]) {
54525465
if (!is_template)
5453-
__ieee80211_beacon_update_cntdwn(beacon);
5466+
__ieee80211_beacon_update_cntdwn(link, beacon);
54545467

54555468
ieee80211_set_beacon_cntdwn(sdata, beacon, link);
54565469
}
@@ -5482,7 +5495,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,
54825495
* for now we leave it consistent with overall
54835496
* mac80211's behavior.
54845497
*/
5485-
__ieee80211_beacon_update_cntdwn(beacon);
5498+
__ieee80211_beacon_update_cntdwn(link, beacon);
54865499

54875500
ieee80211_set_beacon_cntdwn(sdata, beacon, link);
54885501
}

0 commit comments

Comments
 (0)