From: Minxi Hou <houminxi@gmail.com>
To: netdev@vger.kernel.org
Cc: dev@openvswitch.org, aconole@redhat.com, echaudro@redhat.com,
i.maximets@ovn.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
matttbe@kernel.org, shuah@kernel.org,
netdev-bot+sashiko@kernel.org, Minxi Hou <houminxi@gmail.com>
Subject: [PATCH net v6 0/3] net: openvswitch: fix a feature leak on a failed change
Date: Tue, 24 Nov 2026 09:50:30 -0500 [thread overview]
Message-ID: <20261124145033.627044-1-houminxi@gmail.com> (raw)
ovs_dp_change() records the requested features in dp->user_features before
it updates the per-cpu upcall port IDs, and that update fails with -EINVAL
when the per-cpu-pids attribute is empty or its length is not a multiple of
four. The request fails with the new features already recorded, while the
code that takes the reference for TC_RECIRC_SHARING never ran, so a later
request that clears the bit drops a reference that was never taken.
The first two patches are the fix, split so that the single read of
dp->user_features in queue_userspace_packet() stands on its own: it closes a
separate and older oops and carries its own Fixes: tag. The third patch adds
the selftest. The series is three patches; v5 had two.
v6:
- Split the single read of dp->user_features out of the fix. It closes a
crash that aea0bb4f8ee5 introduced in 2014, and folding it into a patch
whose Fixes: tag points at 35d39fecbc24 hid that from a stable backport.
Link: https://lore.kernel.org/netdev/20261118065435.2367014-1-houminxi@gmail.com/
- Move Fixes: and Cc: into the trailer block; they had prose below them.
- Read the field with READ_ONCE() in ovs_dp_set_user_features(), now that
every write to it is a single WRITE_ONCE(), and clear only the recirc bit
through one helper instead of repeating the mask at two sites.
- Carry a changelog per patch in the notes under ---, as Matthieu asked.
- Quote the variables the new selftest helpers pass to subprocesses, and
name both conditions that make the kernel reject the per-cpu-pids
attribute.
- Move Reported-by: to the kernel fix, with the link to the report.
v5: https://lore.kernel.org/netdev/20261118065435.2367014-1-houminxi@gmail.com/
- Use an empty per-cpu-pids attribute to make the update fail, instead of
relying on the masks cache path. Suggested by Matthieu Baerts.
- Report the datapath that cannot be read as that, and not as a feature
mismatch.
v4: https://lore.kernel.org/netdev/20261115163134.3202677-1-houminxi@gmail.com/
- Take and drop the reference in one setter, and call it from every path
that changes or clears the recirc bit, including ovs_dp_reset_user_features()
and __dp_destroy().
- Clear only the recirc bit in __dp_destroy(), so an upcall that is reading
the other bits keeps seeing them.
v3: https://lore.kernel.org/netdev/20261110174651.972936-1-houminxi@gmail.com/
- Describe the user namespace path in the commit message.
- Check the feature bit and the reference count in the selftest instead of
only the return value.
v2: https://lore.kernel.org/netdev/20261108123424.2825403-1-houminxi@gmail.com/
- Split the selftest into its own patch.
- Add the ovs-dpctl set-dp command the selftest needs.
Signed-off-by: Minxi Hou <houminxi@gmail.com>
Minxi Hou (3):
net: openvswitch: read the datapath features once when sending an
upcall
net: openvswitch: do not record user features when the change fails
selftests/net/openvswitch: check that a failed set keeps the features
net/openvswitch/datapath.c | 70 +++++--
net/openvswitch/datapath.h | 7 +-
.../testing/selftests/net/openvswitch/config | 3 +
.../selftests/net/openvswitch/openvswitch.sh | 195 ++++++++++++++++++
.../selftests/net/openvswitch/ovs-dpctl.py | 74 +++++++
5 files changed, 331 insertions(+), 18 deletions(-)
base-commit: 2a324a58a084c5cfd7e5a2f55e0786bee170a4a5
--
2.56.1
next reply other threads:[~2026-11-24 14:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 14:50 Minxi Hou [this message]
2026-11-24 14:50 ` [PATCH net v6 1/3] net: openvswitch: read the datapath features once when sending an upcall Minxi Hou
2026-11-24 14:50 ` [PATCH net v6 2/3] net: openvswitch: do not record user features when the change fails Minxi Hou
2026-11-24 14:50 ` [PATCH net v6 3/3] selftests/net/openvswitch: check that a failed set keeps the features Minxi Hou
2026-11-24 14:52 ` [PATCH net v6 0/3] net: openvswitch: fix a feature leak on a failed change netdev-bot+sinfo
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=20261124145033.627044-1-houminxi@gmail.com \
--to=houminxi@gmail.com \
--cc=aconole@redhat.com \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=echaudro@redhat.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=i.maximets@ovn.org \
--cc=kuba@kernel.org \
--cc=matttbe@kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/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