CVE-2026-63918: l2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname
In the Linux kernel, the following vulnerability has been resolved:
l2tp: use refcountincnotzero in l2tpsessiongetbyifname
A reader in l2tpsessiongetbyifname() can return a pointer to a session whose refcount has reached zero. The getter takes its reference with plain refcountinc(), but every other session getter in the same file (l2tpv2sessionget, l2tpv3sessionget, and the corresponding getnext variants) uses refcountincnotzero() because the IDR/RCU lookup can race with refcountdecandtest() -> l2tpsessionfree() -> kfreercu(). The ifname getter is the only outlier; the inconsistency was raised on-list after 979c017803c4 ("l2tp: use listdelrcu in l2tpsessionunhash").
A reader inside rcureadlockbh() that matches session->ifname can be preempted between the strcmp() and the refcountinc(). If the last reference drops on another CPU in that window, the reader's refcountinc() runs on a counter that has reached zero. refcountt catches the addition-on-zero, prints "refcountt: addition on 0; use-after-free", saturates the counter, and returns the saturated pointer to the caller. Session memory is held live by the in-flight RCU read section, but the kfreercu() callback queued from l2tpsessionfree() will free it once the grace period closes; a caller that dereferences the returned session past that point hits a slab-use-after-free. On PREEMPTRT localbhdisable() is a per-CPU sleeping lock and the preemption window is real; on stock PREEMPT kernels localbhdisable() is a preemptcount increment that closes the cross-CPU race in practice (see below).
Use refcountincnotzero() and continue the list walk on failure, matching the other session getters in the file. The ifname getter is the only session getter in net/l2tp/ that still uses the bare refcountinc() pattern; this change restores file-internal consistency. The success path is unchanged.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.94-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.0.12-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.113-1Fixed in 7.2.12-1Fixed in 7.2.14-1 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.93 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.35 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.0.12
Event History
Frequently Asked Questions
What conditions are required to trigger this issue?
A local attacker needs the ability to race L2TP session lookup by interface name against teardown of the same session. The race occurs when a reader is preempted after matching session->ifname but before taking its reference, while another CPU drops the final session reference.
How can administrators identify signs that the system encountered this race?
The kernel may emit the diagnostic "refcount_t: addition on 0; use-after-free" when the affected lookup attempts to increment a session reference count that has reached zero. This indicates the unsafe reference acquisition path was reached.
What code behavior fixes the problem?
The affected L2TP interface-name session getter must acquire references with refcount_inc_not_zero() rather than refcount_inc(). This prevents returning a session pointer after its reference count has reached zero.