diff options
| author | Ralf Lici <ralf@mandelbit.com> | 2026-01-30 18:32:48 +0100 |
|---|---|---|
| committer | Antonio Quartulli <antonio@openvpn.net> | 2026-02-12 15:28:56 +0100 |
| commit | 93686c472eb7b09a51b97a096449e7092fefcd1f (patch) | |
| tree | 5cf9954ade12eabebf047c45eccf65dab5b8b9f8 /include/linux/i2c/git@git.tavy.me:linux.git | |
| parent | bf9cf80cab81e39701861a42877a28295ade266f (diff) | |
ovpn: set sk_user_data before overriding callbacks
During initialization, we override socket callbacks and set sk_user_data
to an ovpn_socket instance. Currently, these two operations are
decoupled: callbacks are overridden before sk_user_data is set. While
existing callbacks perform safety checks for NULL or non-ovpn
sk_user_data, this condition causes a "half-formed" state where valid
packets arriving during attachment trigger error logs (e.g., "invoked on
non ovpn socket").
Set sk_user_data before overriding the callbacks so that it can be
accessed safely from them. Since we already check that the socket has no
sk_user_data before setting it, this remains safe even if an interrupt
accesses the socket after sk_user_data is set but before the callbacks
are overridden.
This also requires initializing all protocol-specific fields (such as
tcp_tx_work and peer links) before calling ovpn_socket_attach, ensuring
the ovpn_socket is fully formed before it becomes visible to any
callback.
Fixes: f6226ae7a0cd ("ovpn: introduce the ovpn_socket object")
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Diffstat (limited to 'include/linux/i2c/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
