Netdev List
 help / color / mirror / Atom feed
* [PATCH net v6 0/3] net: openvswitch: fix a feature leak on a failed change
@ 2026-11-24 14:50 Minxi Hou
  2026-11-24 14:50 ` [PATCH net v6 1/3] net: openvswitch: read the datapath features once when sending an upcall Minxi Hou
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Minxi Hou @ 2026-11-24 14:50 UTC (permalink / raw)
  To: netdev
  Cc: dev, aconole, echaudro, i.maximets, davem, edumazet, kuba, pabeni,
	horms, matttbe, shuah, netdev-bot+sashiko, Minxi Hou

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-24 15:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 14:50 [PATCH net v6 0/3] net: openvswitch: fix a feature leak on a failed change Minxi Hou
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
2026-11-24 15:08   ` Minxi Hou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox