From: Antonio Quartulli <antonio@openvpn.net>
To: netdev@vger.kernel.org
Cc: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
Antonio Quartulli <antonio@openvpn.net>,
Sabrina Dubroca <sd@queasysnail.net>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH net 0/5] pull request: fixes for ovpn 2025-06-03
Date: Tue, 3 Jun 2025 13:11:05 +0200 [thread overview]
Message-ID: <20250603111110.4575-1-antonio@openvpn.net> (raw)
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
--
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
next reply other threads:[~2025-06-03 11:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 11:11 Antonio Quartulli [this message]
2025-06-03 11:11 ` [PATCH net 1/5] ovpn: properly deconfigure UDP-tunnel Antonio Quartulli
2025-06-04 13:16 ` Larysa Zaremba
2025-06-04 13:41 ` Antonio Quartulli
2025-06-04 14:34 ` Larysa Zaremba
2025-06-03 11:11 ` [PATCH net 2/5] ovpn: ensure sk is still valid during cleanup Antonio Quartulli
2025-06-03 11:11 ` [PATCH net 3/5] ovpn: avoid sleep in atomic context in TCP RX error path Antonio Quartulli
2025-06-03 11:11 ` [PATCH net 4/5] selftest/net/ovpn: fix TCP socket creation Antonio Quartulli
2025-06-03 11:11 ` [PATCH net 5/5] selftest/net/ovpn: fix missing file Antonio Quartulli
2025-06-05 10:47 ` [PATCH net 0/5] pull request: fixes for ovpn 2025-06-03 Paolo Abeni
2025-06-05 10:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250603111110.4575-1-antonio@openvpn.net \
--to=antonio@openvpn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).