[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a601c049-0926-418b-aa54-31686eea0a78@redhat.com>
Date: Tue, 25 Nov 2025 10:57:15 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Mikhail Lobanov <m.lobanov@...a.ru>, "David S. Miller"
<davem@...emloft.net>
Cc: Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Simon Horman <horms@...nel.org>, David Bauer <mail@...id-bauer.net>,
James Chapman <jchapman@...alix.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: [PATCH net v3] l2tp: fix double dst_release() on sk_dst_cache
race
On 11/14/25 2:06 AM, Mikhail Lobanov wrote:
> diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
> index 0710281dd95a..b379b7e6470a 100644
> --- a/net/l2tp/l2tp_core.c
> +++ b/net/l2tp/l2tp_core.c
> @@ -1210,9 +1210,17 @@ static int l2tp_xmit_queue(struct l2tp_tunnel *tunnel, struct sk_buff *skb, stru
> skb->ignore_df = 1;
> skb_dst_drop(skb);
> #if IS_ENABLED(CONFIG_IPV6)
> - if (l2tp_sk_is_v6(tunnel->sock))
> + if (l2tp_sk_is_v6(tunnel->sock)) {
> + struct dst_entry *dst = __sk_dst_get(tunnel->sock);
> +
> + if (dst) {
> + if (dst && READ_ONCE(dst->obsolete) &&
> + dst->ops->check(dst,
> + inet6_sk(tunnel->sock)->dst_cookie) == NULL)
> + sk_dst_reset(tunnel->sock);
> + }
The above looks still racy, even if with a smaller race window: AFAICS
the DST could be obsoleted after this point, and later inet6_csk_xmit()
could still race udpv6_sendmsg().
Also I *think* the same race exists for ipv4.
On top of my head, the only safe solution I could think of is replacing
the inet6_csk_xmit()/ip_queue_xmit() calls in l2tp with an open coded
variants using sk_dst_check() - alike what UDP is doing.
The above would be net-next material.
/P
Powered by blists - more mailing lists