l2tp: free sessions using rcu

BugLink: https://bugs.launchpad.net/bugs/2097301

[ Upstream commit d17e89999574aca143dd4ede43e4382d32d98724 ]

l2tp sessions may be accessed under an rcu read lock. Have them freed
via rcu and remove the now unneeded synchronize_rcu when a session is
removed.

Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com>
Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
This commit is contained in:
James Chapman
2024-07-29 16:38:08 +01:00
committed by Mehmet Basaran
parent 2c4f7e8018
commit b5a3caa419
2 changed files with 2 additions and 3 deletions
+1 -3
View File
@@ -165,7 +165,7 @@ static void l2tp_session_free(struct l2tp_session *session)
trace_free_session(session);
if (session->tunnel)
l2tp_tunnel_dec_refcount(session->tunnel);
kfree(session);
kfree_rcu(session, rcu);
}
struct l2tp_tunnel *l2tp_sk_to_tunnel(struct sock *sk)
@@ -1214,8 +1214,6 @@ static void l2tp_session_unhash(struct l2tp_session *session)
hlist_del_init_rcu(&session->global_hlist);
spin_unlock_bh(&pn->l2tp_session_hlist_lock);
}
synchronize_rcu();
}
}
+1
View File
@@ -70,6 +70,7 @@ struct l2tp_session_cfg {
struct l2tp_session {
int magic; /* should be L2TP_SESSION_MAGIC */
long dead;
struct rcu_head rcu;
struct l2tp_tunnel *tunnel; /* back pointer to tunnel context */
u32 session_id;