From: Andrey Misiurov <amisiurov@cloudlinux.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "Toke Høiland-Jørgensen" <toke@toke.dk>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
"Andrey Misiurov" <amisiurov@cloudlinux.com>
Subject: [PATCH] wifi: mac80211: reject zero or oversized fq_quantum in aqm debugfs
Date: Thu, 19 Nov 2026 18:14:07 +0100 [thread overview]
Message-ID: <20261119171407.1975535-1-amisiurov@cloudlinux.com> (raw)
The aqm debugfs file lets you set fq.quantum, the byte budget a flow gets
each round in the transmit scheduler. aqm_write() accepts any u32 with no
check.
The scheduler keeps draining a flow until its budget runs out. A quantum of
0, or one above INT_MAX, makes that budget never go positive -- it stays 0,
or wraps negative in the signed counter. The loop then never moves on: it
spins forever holding fq->lock, and the first frame sent hangs the CPU:
watchdog: BUG: soft lockup - CPU#1 stuck for 145s! [kworker/1:1]
CPU: 1 PID: 22249 Comm: kworker/1:1
Workqueue: mld mld_ifc_work
RIP: 0010:__list_del_entry_valid+0x21/0x100
Call Trace:
fq_tin_dequeue.constprop.0+0x426/0x8d0 [mac80211]
ieee80211_tx_dequeue+0x817/0x15d0 [mac80211]
ieee80211_handle_wake_tx_queue+0x1ae/0x2a0 [mac80211]
drv_wake_tx_queue+0x1a3/0x350 [mac80211]
ieee80211_queue_skb+0x302/0x610 [mac80211]
ieee80211_tx+0x261/0x3e0 [mac80211]
ieee80211_xmit+0x18c/0x280 [mac80211]
__ieee80211_subif_start_xmit+0x5a3/0xb90 [mac80211]
ieee80211_subif_start_xmit+0xe2/0x7f0 [mac80211]
dev_hard_start_xmit+0x157/0x420
__dev_queue_xmit+0x1116/0x1770
neigh_resolve_output+0x472/0x9c0
ip6_finish_output2+0x87f/0x1320
ip6_output+0x1dd/0x630
mld_sendpack+0x94c/0xd40
mld_ifc_work+0x42/0x270
process_one_work+0x830/0x1330
worker_thread+0x4f3/0xb40
kthread+0x32a/0x410
ret_from_fork+0x2c/0x50
The same lockup was fixed for the netlink knob by d1cba2ea8121, which caps it
at INT_MAX; the debugfs knob was left unchecked (netlink also cannot set 0,
where 0 means "keep"). The file is root-only (0600), so this is hardening.
Fix: read the value into a local and accept only 1..INT_MAX.
Fixes: 9399b86c0e9a ("mac80211: add debug knobs for fair queuing")
Signed-off-by: Andrey Misiurov <amisiurov@cloudlinux.com>
---
Found while reviewing a backport.
Reproduced on almalinux9 5.14.0-503.11.1 debug over mac80211_hwsim: writing
'fq_quantum 0' is accepted and the next TX wedges a CPU as above; with the
fix 'fq_quantum 0' and 2147483648 both return -EINVAL and TX keeps running.
net/mac80211/debugfs.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -117,6 +117,7 @@
{
struct ieee80211_local *local = file->private_data;
char buf[100];
+ u32 quantum;
if (count >= sizeof(buf))
return -EINVAL;
@@ -133,8 +134,12 @@
return count;
else if (sscanf(buf, "fq_memory_limit %u", &local->fq.memory_limit) == 1)
return count;
- else if (sscanf(buf, "fq_quantum %u", &local->fq.quantum) == 1)
+ else if (sscanf(buf, "fq_quantum %u", &quantum) == 1) {
+ if (!quantum || quantum > INT_MAX)
+ return -EINVAL;
+ local->fq.quantum = quantum;
return count;
+ }
return -EINVAL;
}
reply other threads:[~2026-11-19 17:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261119171407.1975535-1-amisiurov@cloudlinux.com \
--to=amisiurov@cloudlinux.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=toke@toke.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®