diff options
author | James Chapman <jchapman@katalix.com> | 2024-07-29 16:38:09 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-07-31 09:25:13 +0100 |
commit | c5cbaef992d6420d8bcebea1b1fcc23302a67c57 (patch) | |
tree | ed5f1ec3458274f524516b476dc9cbc71cefcc11 /kernel/smpboot.h | |
parent | d17e89999574aca143dd4ede43e4382d32d98724 (diff) |
l2tp: refactor ppp socket/session relationship
Each l2tp ppp session has an associated pppox socket. l2tp_ppp uses
the session's pppox socket refcount to manage session lifetimes; the
pppox socket holds a ref on the session which is dropped by the socket
destructor. This complicates session cleanup.
Given l2tp sessions are refcounted, it makes more sense to reverse
this relationship such that the session keeps the socket alive, not
the other way around. So refactor l2tp_ppp to have the session hold a
ref on its socket while it references it. When the session is closed,
it drops its socket ref when it detaches from its socket. If the
socket is closed first, it initiates the closing of its session, if
one is attached. The socket/session can then be freed asynchronously
when their refcounts drop to 0.
Use the session's session_close callback to detach the pppox socket
since this will be done on the work queue together with the rest of
the session cleanup via l2tp_session_delete.
Also, since l2tp_ppp uses the pppox socket's sk_user_data, use the rcu
sk_user_data access helpers when accessing it and set the socket's
SOCK_RCU_FREE flag to have pppox sockets freed by rcu.
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>
Diffstat (limited to 'kernel/smpboot.h')
0 files changed, 0 insertions, 0 deletions