[Openvpn-devel,net,v5,0/6] ovpn: fix key and workqueue lifetime issues

Message ID cover.1783336121.git.ralf@mandelbit.com
Headers
Series ovpn: fix key and workqueue lifetime issues |

Message

Ralf Lici July 6, 2026, 11:33 a.m. UTC
  Hi,

This series collects the ovpn fixes we discussed around key-slot
handling, netlink key notifications, TCP initialization ordering, and
teardown of deferred work.

The first two patches were sent separately before. They are included
here again so the whole set can be picked in the intended order.

The last three patches fix lifetime problems where callback/workqueue
cleanup could continue after the reference that pins netdev/module
teardown had already been dropped. The series first makes crypto
callbacks finish their own cleanup before releasing the peer, then moves
ovpn work items to a module-owned workqueue that is drained during
module exit, and finally defers key-slot AEAD transform freeing to that
workqueue so crypto_free_aead() does not run from an RCU callback.

This series is based on top of these pending ovpn net fixes, which are
not included here:

  commit 746ed3312a64 ("ovpn: hold peer before scheduling keepalive work")
  commit 2e32df6613f3 ("ovpn: fix peer refcount leak in TCP error paths")

Thanks,

Ralf Lici
Mandelbit Srl

---
Changes since v4 https://lore.kernel.org/openvpn-devel/981d2ea51cca45138210aa52c6e5a0e55c0da7a0.1783099626.git.ralf@mandelbit.com/
- Include the NULL-slot and key-id notification fixes in this series so
  the whole set can be picked in order.
- Add the TCP initialization ordering fix before the teardown/workqueue
  fixes.
- Rebase the workqueue conversion on the pending keepalive and TCP
  deferred-work refcount fixes listed above.

Ralf Lici (6):
  ovpn: fix NULL dereference when killing missing key
  ovpn: use nla_put_u32 for the key ID attribute in
    ovpn_nl_key_swap_notify
  ovpn: initialize TCP state before registering UAPI
  ovpn: finish crypto callback cleanup before peer release
  ovpn: run deferred work on a module-owned workqueue
  ovpn: defer key slot crypto freeing to workqueue

 drivers/net/ovpn/crypto.c      | 25 +++++++++++--------------
 drivers/net/ovpn/crypto.h      |  3 +++
 drivers/net/ovpn/crypto_aead.c | 20 ++++++++++++++------
 drivers/net/ovpn/crypto_aead.h |  1 -
 drivers/net/ovpn/io.c          | 10 +++++-----
 drivers/net/ovpn/main.c        | 27 +++++++++++++++++++++++----
 drivers/net/ovpn/netlink.c     |  2 +-
 drivers/net/ovpn/ovpnpriv.h    |  4 ++++
 drivers/net/ovpn/peer.c        |  8 ++++----
 drivers/net/ovpn/tcp.c         |  9 ++++-----
 10 files changed, 69 insertions(+), 40 deletions(-)