From: Guillaume Nault <gnault@redhat.com>
To: Hengyu Liang <hengyul@cs.unc.edu>
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org, horms@kernel.org,
jchapman@katalix.com, tparkin@katalix.com,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net] l2tp: only return sessions of the given tunnel in l2tp_session_get()
Date: Mon, 26 Oct 2026 12:51:54 +0100 [thread overview]
Message-ID: <at8-2mFyrmPxfu29@debian> (raw)
In-Reply-To: <20261025145831.2133617-1-hengyul@cs.unc.edu>
On Sun, Oct 25, 2026 at 10:58:31AM -0400, Hengyu Liang wrote:
> @@ -315,10 +315,19 @@ EXPORT_SYMBOL_GPL(l2tp_v2_session_get);
> struct l2tp_session *l2tp_session_get(const struct net *net, struct sock *sk, int pver,
> u32 tunnel_id, u32 session_id)
> {
> + struct l2tp_session *session;
> +
> if (pver == L2TP_HDR_VER_2)
> return l2tp_v2_session_get(net, tunnel_id, session_id);
> - else
> - return l2tp_v3_session_get(net, sk, session_id);
> +
> + /* An L2TPv3 session ID that has not collided may be in any tunnel */
> + session = l2tp_v3_session_get(net, sk, session_id);
> + if (session && session->tunnel->tunnel_id != tunnel_id) {
> + l2tp_session_put(session);
> + return NULL;
> + }
> +
> + return session;
> }
The original code looks correct to me. L2TPv3 sessions, unlike L2TPv2
ones, are global to all tunnels sharing the same socket.
prev parent reply other threads:[~2026-10-26 11:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 14:58 Hengyu Liang
2026-10-25 15:01 ` netdev-bot+sinfo
2026-10-26 11:51 ` Guillaume Nault [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=at8-2mFyrmPxfu29@debian \
--to=gnault@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hengyul@cs.unc.edu \
--cc=horms@kernel.org \
--cc=jchapman@katalix.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tparkin@katalix.com \
/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®