Message ID | eae2f69427371bc679626f4d794f2ed59e4bdc86.1723011569.git.jchapman@katalix.com (mailing list archive) |
---|---|
State | Accepted |
Commit | b0a8deda060d51ebe4614ed6e1829d933139ba1a |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | l2tp: misc improvements | expand |
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 608a7beda9d5..28e6367f2483 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c @@ -286,7 +286,8 @@ struct l2tp_session *l2tp_v3_session_get(const struct net *net, struct sock *sk, */ struct l2tp_tunnel *tunnel = READ_ONCE(session->tunnel); - if (tunnel && tunnel->sock == sk && + if (session->session_id == session_id && + tunnel && tunnel->sock == sk && refcount_inc_not_zero(&session->ref_count)) { rcu_read_unlock_bh(); return session;