Skip to content

pull request: fixes for ovpn 2025-06-03

Antonio Quartulli netdev 1 version Applied

Status from this message: This series was applied to netdev/net.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 4 repliesApplied 5/5

Patches in v1 All 5 applied

#Subject and filesSizeRepliesApplied
1/5ovpn: properly deconfigure UDP-tunneldrivers/net/ovpn/udp.c+11 -33 repliesApplied
2/5ovpn: ensure sk is still valid during cleanupdrivers/net/ovpn/io.c drivers/net/ovpn/netlink.c drivers/net/ovpn/peer.c +6 more+102 -1040 repliesApplied
3/5ovpn: avoid sleep in atomic context in TCP RX error pathdrivers/net/ovpn/tcp.c+6 -20 repliesApplied
4/5selftest/net/ovpn: fix TCP socket creationtools/testing/selftests/net/ovpn/ovpn-cli.c+1 -00 repliesApplied
5/5selftest/net/ovpn: fix missing filetools/testing/selftests/net/ovpn/test-large-mtu.sh+9 -00 repliesApplied

Reviews trailers per patch

3 of 5 patches have a Reviewed-by or Acked-by.

PatchGert DoeringMichal SwiatkowskiLarysa Zaremba
1/5R-b
2/5T-b R-b
3/5R-b
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH net 0/5] pull request: fixes for ovpn 2025-06-03

Hi netdev-team,
[2025-06-03: added WRITE_ONCE() to 1/5]

In this batch you can find the following bug fixes:

Patch 1: when releasing a UDP socket we were wrongly invoking setup_udp_tunnel_sock() with an empty config. This was not properly shutting down the UDP encap state.
With this patch we simply undo what was done during setup.

Patch 2: ovpn was holding a reference to a 'struct socket' without increasing its reference counter. This was intended and worked as expected until we hit a race condition where user space tries to close the socket while kernel space is also releasing it. In this case the (struct socket *)->sk member would disappear under our feet leading to a null-ptr-deref. This patch fixes this issue by having struct ovpn_socket hold a reference directly to the sk member while also increasing its reference counter.

Patch 3: in case of errors along the TCP RX path (softirq) we want to immediately delete the peer, but this operation may sleep. With this patch we move the peer deletion to a scheduled worker.

Patch 4 and 5 are instead fixing minor issues in the ovpn kselftests.

Please pull or let me know of any issue

Thanks a lot,
Antonio

Antonio Quartulli (5):
ovpn: properly deconfigure UDP-tunnel
ovpn: ensure sk is still valid during cleanup
ovpn: avoid sleep in atomic context in TCP RX error path selftest/net/ovpn: fix TCP socket creation selftest/net/ovpn: fix missing file

 drivers/net/ovpn/io.c                         |  8 +-
 drivers/net/ovpn/netlink.c                    | 16 ++--
 drivers/net/ovpn/peer.c                       |  4 +-
 drivers/net/ovpn/socket.c                     | 68 +++++++++--------
 drivers/net/ovpn/socket.h                     |  4 +-
 drivers/net/ovpn/tcp.c                        | 73 ++++++++++---------
 drivers/net/ovpn/tcp.h                        |  3 +-
 drivers/net/ovpn/udp.c                        | 46 ++++++------
 drivers/net/ovpn/udp.h                        |  4 +-
 tools/testing/selftests/net/ovpn/ovpn-cli.c   |  1 +
 .../selftests/net/ovpn/test-large-mtu.sh      |  9 +++
 11 files changed, 128 insertions(+), 108 deletions(-)
 create mode 100755 tools/testing/selftests/net/ovpn/test-large-mtu.sh
Signature · 44 lines
2.49.0

The following changes since commit 408da3a0f89d581421ca9bd6ff39c7dd05bc4b2f:

  Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue (2025-06-02 18:44:37 -0700)

are available in the Git repository at:

  https://github.com/OpenVPN/ovpn-net-next tags/ovpn-net-20250603

for you to fetch changes up to 9c7e8b31da035fe81399891b2630a8e0c4b09137:

  selftest/net/ovpn: fix missing file (2025-06-03 13:08:15 +0200)

----------------------------------------------------------------
This bugfix batch includes the following changes:
* dropped bogus call to setup_udp_tunnel_sock() during
  cleanup, substituted by proper state unwind
* fixed race condition between peer removal (by kernel
  space) and socket closing (by user space)
* fixed sleep in atomic context along TCP RX error path
* fixes for ovpn kselftests

----------------------------------------------------------------
Antonio Quartulli (5):
      ovpn: properly deconfigure UDP-tunnel
      ovpn: ensure sk is still valid during cleanup
      ovpn: avoid sleep in atomic context in TCP RX error path
      selftest/net/ovpn: fix TCP socket creation
      selftest/net/ovpn: fix missing file

 drivers/net/ovpn/io.c                              |  8 +--
 drivers/net/ovpn/netlink.c                         | 16 ++---
 drivers/net/ovpn/peer.c                            |  4 +-
 drivers/net/ovpn/socket.c                          | 68 +++++++++++---------
 drivers/net/ovpn/socket.h                          |  4 +-
 drivers/net/ovpn/tcp.c                             | 73 +++++++++++-----------
 drivers/net/ovpn/tcp.h                             |  3 +-
 drivers/net/ovpn/udp.c                             | 46 +++++++-------
 drivers/net/ovpn/udp.h                             |  4 +-
 tools/testing/selftests/net/ovpn/ovpn-cli.c        |  1 +
 tools/testing/selftests/net/ovpn/test-large-mtu.sh |  9 +++
 11 files changed, 128 insertions(+), 108 deletions(-)
 create mode 100755 tools/testing/selftests/net/ovpn/test-large-mtu.sh