CVE-2026-142806: net/sched: sch_teql: fix slaves_lock IRQ deadlock
In the Linux kernel, the following vulnerability has been resolved:
net/sched: schteql: fix slaveslock IRQ deadlock
This is a followup of commit e5b811fe7931 ("net/sched: schteql: Introduce slaveslock to avoid race condition and UAF") as reported by Sashiko.
The issue: master->slaveslock serializes the master's ring of slave qdiscs. The control paths -- teqldequeue(), teqldestroy() and teqlqdiscinit() -- take it with spinlockbh(), while teqlmasterxmit() (the master's ndostartxmit) takes it with plain spinlock().
netpollsendskb() wraps the transmit in localirqsave(), and netpollsendskb() asserts lockdepassertirqsdisabled(), so teqlmasterxmit() reached from netconsole always acquires slaveslock with hard IRQs disabled. On PREEMPTRT spinlockt is an rtmutex, and Documentation/locking/locktypes.rst names
localirqdisable(); spinlock(&lock);
as a sequence that breaks there because the rtmutex requires a fully preemptible context. This is reachable without any panic: the nbcon printer thread calls netconsole's writethread() callback on every message. The usual remedy -- folding the IRQ disable into the lock with spinlockirqsave() -- is unavailable because the localirqsave() is netpoll's, not ours.
On non-RT the same asymmetry leaves slaveslock acquirable with hard IRQs disabled on one path and held with hard IRQs enabled on another. That is only exploitable during the panic console flush (netconsole is CONNBCONATOMICUNSAFE, so consoleisusable() admits its writeatomic() only from nbconatomicflushunsafe(), which panic() alone calls), and even then an IRQ-saving lock does not help if the holder oopsed inside the section or was stopped by panicothercpusshutdown(). So the non-RT half is hardening; the PREEMPTRT half is the bug.
The Fix: take slaveslock as a raw spinlock with IRQs saved at every site. Since skbqueuepurge() takes the queue's spinlockt and may not nest inside a raw lock on PREEMPTRT, move its call in teqldestroy() outside the raw section; dat->q is the dying qdisc's own queue and was never serialized by slaveslock, so the move is behaviour-neutral.
The new critical sections contain only RCU pointer assignments and netdevgettxqueue(); skbqueuepurge(), netifwakequeue() and devresetqueue() are all outside them. teqldestroy()'s ring walk is O(slaves), two pointer loads and a compare per iteration, so even a large ring is microseconds with IRQs off. Keeping the purge conditional rather than dropping it outright is the conservative call for a backport.
Some context: commit 6301f6a34ed8 ("net/sched: schteql: move rcureadlock()/spinlock() from bh variants") hardened the parent fix; together they addressed the master->slaves resurrection use-after-free and the xmit-side BH warning but left the reverse direction -- a hard IRQ re-entering xmit while a control path holds the lock -- unaddressed.
Conditions to recreate the bug: - CONFIGPREEMPTRT, CONFIGNETSCHTEQL, CONFIGDUMMY and CONFIGNETCONSOLE. - Run ip link add dev teqlslave0 type dummy, bring teqlslave0 up, attach it with tc qdisc add dev teqlslave0 root teql0, and bring teql0 up. - Configure a netconsole target on teql0 with explicit local and remote IP addresses and a remote MAC address, then emit a console message. The nbcon printer thread reaches teqlmasterxmit() with hard IRQs disabled by netpoll; taking slaveslock as a spinlockt is invalid on PREEMPTRT. No panic or concurrent qdisc change is required. - Reachable by an admin with CAPNETADMIN; teql devices exist only in the initial netns (no per-netns ops), so a user namespace does not suffice.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In sch_teql, use a raw spinlock for slaves_lock with IRQs saved at each lock site, and move skb_queue_purge() in teql_destroy() outside the raw-lock section.
Event History
Frequently Asked Questions
Which systems are most exposed to this issue?
The described problematic path involves the TEQL qdisc master transmit path, netconsole/netpoll transmission, and PREEMPT_RT kernels. On PREEMPT_RT, the affected lock is an rtmutex and cannot be acquired in the hard-IRQ-disabled context reached through netconsole.
What activity triggers the problematic locking path?
A netconsole transmission reaches teql_master_xmit() with hard IRQs disabled through netpoll_send_skb(). The nbcon printer thread can invoke netconsole's write_thread() callback for every message, so the path is reachable without requiring a panic.