From: Paolo Abeni <pabeni@redhat.com>
To: Mikhail Lobanov <m.lobanov@rosa.ru>,
"David S . Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
David Bauer <mail@david-bauer.net>,
James Chapman <jchapman@katalix.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: Re: [PATCH net-next v9] l2tp: fix double dst_release() on sk_dst_cache race
Date: Thu, 4 Jun 2026 15:41:21 +0200 [thread overview]
Message-ID: <3564485c-0969-40bf-8f18-c9eb36c4065e@redhat.com> (raw)
In-Reply-To: <20260601213302.18761-1-m.lobanov@rosa.ru>
On 6/1/26 11:33 PM, Mikhail Lobanov wrote:
> +static int l2tp_xmit_ipv4(struct sock *sk, struct sk_buff *skb, struct flowi *fl)
> +{
> + struct inet_sock *inet = inet_sk(sk);
> + struct net *net = sock_net(sk);
> + struct ip_options_rcu *inet_opt;
Since a repost is needed, please additionaly fix the variable
declaration order above ...
> + struct flowi4 *fl4;
> + struct rtable *rt;
> + __u8 tos;
> + int err;
> +
> + rcu_read_lock();
> + inet_opt = rcu_dereference(inet->inet_opt);
> + fl4 = &fl->u.ip4;
> + tos = READ_ONCE(inet->tos);
> +
> + rt = dst_rtable(sk_dst_check(sk, 0));
> + if (!rt) {
> + __be32 daddr = inet->inet_daddr;
> +
> + if (inet_opt && inet_opt->opt.srr)
> + daddr = inet_opt->opt.faddr;
> +
> + rt = ip_route_output_ports(net, fl4, sk,
> + daddr, inet->inet_saddr,
> + inet->inet_dport,
> + inet->inet_sport,
> + sk->sk_protocol,
> + tos & INET_DSCP_MASK,
> + READ_ONCE(sk->sk_bound_dev_if));
> + if (IS_ERR(rt)) {
> + rcu_read_unlock();
> + IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES);
> + kfree_skb_reason(skb, SKB_DROP_REASON_IP_OUTNOROUTES);
> + return -EHOSTUNREACH;
> + }
> +
> + sk_setup_caps(sk, &rt->dst);
> + }
> +
> + skb_dst_set_noref(skb, &rt->dst);
> + rcu_read_unlock();
> +
> + err = ip_queue_xmit(sk, skb, fl);
> + return err;
> +}
> +
> /* Queue the packet to IP for output: tunnel socket lock must be held */
> static int l2tp_xmit_queue(struct l2tp_tunnel *tunnel, struct sk_buff *skb, struct flowi *fl)
> {
> int err;
> + struct sock *sk = tunnel->sock;
... and here, too.
Thanks,
Paolo
prev parent reply other threads:[~2026-06-04 13:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 21:33 Mikhail Lobanov
2026-06-04 13:39 ` Paolo Abeni
2026-06-04 13:41 ` Paolo Abeni [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=3564485c-0969-40bf-8f18-c9eb36c4065e@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jchapman@katalix.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=m.lobanov@rosa.ru \
--cc=mail@david-bauer.net \
--cc=netdev@vger.kernel.org \
/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®