Commit d17e8999 authored by James Chapman's avatar James Chapman Committed by David S. Miller

l2tp: free sessions using rcu

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: default avatarJames Chapman <jchapman@katalix.com>
Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fc7ec7f5
......@@ -166,7 +166,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(const struct sock *sk)
......@@ -1269,8 +1269,6 @@ static void l2tp_session_unhash(struct l2tp_session *session)
spin_unlock_bh(&pn->l2tp_session_idr_lock);
spin_unlock_bh(&tunnel->list_lock);
synchronize_rcu();
}
}
......
......@@ -66,6 +66,7 @@ struct l2tp_session_coll_list {
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment