From: Linkui Xiao <xiaolinkui@126.com>
To: netdev-bot+sashiko@kernel.org
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, gnault@redhat.com,
kuniyu@google.com, michael.bommarito@gmail.com,
alice.kernel@fastmail.im, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, xiaolinkui@kylinos.cn,
stable@vger.kernel.org
Subject: Re: [PATCH net] l2tp: fix use-after-free in l2tp_udp_encap_recv()
Date: Tue, 3 Nov 2026 16:33:57 +0800 [thread overview]
Message-ID: <d02b00db-d916-412b-ad6c-21959c63c43a@126.com> (raw)
In-Reply-To: <179340002340.3131.5823454250644987437@kernel.org>
On 2026/10/31 06:40, netdev-bot+sashiko@kernel.org wrote:
> - [Medium] The commit message describes a use-after-free that no code
> path in the current tree can trigger.
>
> Can the backlog path described here actually be reached?
Agreed -- it cannot. pppol2tp_backlog_recv() is the only
sk_backlog_rcv callback that calls l2tp_udp_encap_recv(), and nothing
ever queues skbs on a PPPoL2TP socket's backlog: sk_add_backlog() is
only reached from __sk_receive_skb(), tcp, sctp, tipc and x25, and the
__sk_receive_skb() callers (pppoe, pptp, l2tp_ip, l2tp_ip6, phonet and
vmci) all target their own socket families, never a PF_PPPOX /
PX_PROTO_OL2TP socket. pppol2tp_recv() delivers payload with
sock_queue_rcv_skb(), which does not use the backlog either.
> The live entry point is the UDP encap hook set up in
> l2tp_tunnel_register():
>
> .encap_rcv = l2tp_udp_encap_recv,
Right. That hook is only called from udp_queue_rcv_one_skb() and
udpv6_queue_rcv_one_skb(), under the rcu_read_lock() taken in
ip_local_deliver_finish() and ip6_input(), so the receive path always
holds an RCU read-side reference. Combined with the kfree_rcu() in
l2tp_tunnel_free(), the tunnel memory cannot go away while it is being
dereferenced, and a strict grace period still cannot end inside a
read-side section, so CONFIG_RCU_STRICT_GRACE_PERIOD cannot expose it
either. The description of __release_sock() in my commit message was
accurate in itself, but the path is unreachable, so presenting this as
a reachable use-after-free was wrong.
> The reordering itself looks correct as hardening. Would it be more
> accurate to describe it that way, and to drop or justify the
> Cc: stable tag, rather than present it as a reachable use-after-free?
Agreed. I will respin with the reorder described as hardening: it
removes the dependency on every caller of l2tp_udp_encap_recv()
holding an RCU read-side reference, which holds today but is fragile.
The subject changes accordingly and I drop the backport tags, since
there is no reachable bug to backport.
> Also, pppol2tp_backlog_recv() appears to be unreachable, and it passes a
> PPPoX sk to a function that expects a UDP tunnel socket. Could it be
> removed as part of a respin?
Agreed that it is dead code. Since it is a cleanup rather than a fix,
I would rather not mix it into this series. Its removal is already
covered by Qingfang Deng's in-flight net-next series ("l2tp: ppp:
remove unused backlog callback"), so I will leave it to that thread
instead of posting a duplicate.
pw-bot: cr
prev parent reply other threads:[~2026-11-03 8:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 6:36 Linkui Xiao
2026-10-30 22:40 ` netdev-bot+sashiko
2026-11-03 8:33 ` Linkui Xiao [this message]
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=d02b00db-d916-412b-ad6c-21959c63c43a@126.com \
--to=xiaolinkui@126.com \
--cc=alice.kernel@fastmail.im \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gnault@redhat.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.bommarito@gmail.com \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=xiaolinkui@kylinos.cn \
/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®