Root cause: a backport mismatch in pppol2tp_ioctl(). Fixed in 6.8.0-151
(currently in -proposed); I tested it, see the end of this comment.
I compared net/l2tp/ in the Ubuntu noble git tags Ubuntu-6.8.0-138.138,
Ubuntu-6.8.0-149.149 and Ubuntu-6.8.0-151.151.
1. Between 138 and 149, the l2tp_core.c changes are only renames
(l2tp_*_inc_refcount() -> refcount_inc(), l2tp_*_dec_refcount() ->
l2tp_*_put()) plus refcount_inc_not_zero() in
l2tp_session_get_by_ifname(). They change nothing functionally.
2. The functional change is in l2tp_ppp.c: the 6.8.0-146 upload
(upstream stable patchset 2026-08-21, LP: #2164796, CVE-2026-53262)
backported "l2tp: pppol2tp: hold reference to session in
pppol2tp_ioctl()". pppol2tp_ioctl() now does:
session = pppol2tp_sock_to_session(sock->sk);
...
if (session)
l2tp_session_put(session);
In mainline, pppol2tp_sock_to_session() takes a *session* reference
(refcount_inc_not_zero(&session->ref_count)), so l2tp_session_put() is the
matching release there.
In the 6.8 tree, pppol2tp_sock_to_session() still takes a *socket* reference
(sock_hold(sk)), and all of its other callers release it with sock_put(sk).
3. As a result, on 6.8.0-146 to -149, every ioctl that reaches
pppol2tp_ioctl() on a connected PPPoL2TP socket drops a session
reference that was never taken, and it leaks a socket reference.
pppox_ioctl() passes every command except PPPIOCGCHAN to
pppol2tp_ioctl(). During connection setup the session refcount therefore
reaches zero, and the session is freed (kfree_rcu) while it is still
hashed in the tunnel and still attached to sk_user_data.
4. This matches all the traces attached to this bug:
- "refcount_t: addition on 0; use-after-free" in l2tp_tunnel_get_session()
<- l2tp_udp_recv_core(), in the same second the tunnel comes up: the RX path
finds the already-released session. The "underflow" and "saturated" warnings
follow.
- "WARNING ... at net/l2tp/l2tp_ppp.c:166 pppol2tp_xmit": in the 6.8.0-149
source, line 166 is WARN_ON(session->magic != L2TP_SESSION_MAGIC) in
pppol2tp_sock_to_session(). The session memory has been reused.
- Then slab corruption: general protection faults in __kmalloc /
kmalloc_node_trace in unrelated tasks, and the full freeze.
- 6.8.0-138 does not contain this patch, which is why it is unaffected.
5. 6.8.0-151 (upstream stable patchset 2026-11-03, LP: #2172887, again
listed under CVE-2026-53262) changes exactly these two lines in
pppol2tp_ioctl():
- l2tp_session_put(session);
+ sock_put(sock->sk);
This restores the balance with pppol2tp_sock_to_session().
Test result: 6.8.0-151.151~22.04.1 from jammy-proposed fixes it.
On 6.8.0-149, every connection of this L2TP/IPsec VPN (3 out of 3)
logged the refcount_t warnings in the same second the tunnel came up.
On 6.8.0-151.151~22.04.1, installed from jammy-proposed, with the same
machine, VPN and userspace (xl2tpd 1.3.16 with "Using l2tp kernel
support", strongswan 5.9.5, network-manager-l2tp 1.20.20), I ran 21
connections on 2026-11-26, 17 of them back-to-back disconnect/reconnect
cycles. Between cycles, about 200 packets/s went through the tunnel, and
continuous traffic followed. There was not a single refcount_t,
l2tp_ppp.c:166, general protection fault or Oops in the kernel log.
Please consider this bug fixed by 6.8.0-151 (stable patchset 2026-11-03,
LP: #2172887), and keep the pppol2tp_ioctl() fix when 6.8.0-151 moves to
-updates.
The report from 2026-11-25 (Ubuntu 24.04, browser only, no L2TP) cannot
hit this code path, because it only runs with PPPoL2TP sockets. It is
probably a different bug and would deserve its own report (ubuntu-bug
linux).
** CVE added: https://cve.org/CVERecord?id=CVE-2026-53262
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2174480
Title:
6.8.0-149: refcount use-after-free in l2tp_tunnel_get_session when an
L2TP/IPsec VPN connects, then kernel oops / full freeze
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-hwe-6.8/+bug/2174480/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs