linux/net/openvswitch
Norbert Szetei 0dbc2398fc openvswitch: only skb_tx_error() a packet we are about to drop
queue_userspace_packet() borrows the packet skb -- it only copies it into
a private netlink message (user_skb) and does not own it; on return
do_execute_actions() keeps forwarding it through the flow's remaining
actions. Its error path nevertheless calls skb_tx_error(skb), which via
skb_zcopy_clear() does skb_shinfo(skb)->flags &= ~SKBFL_ALL_ZEROCOPY,
stripping SKBFL_SHARED_FRAG from that live skb (skb_tx_error()'s kerneldoc
says "skb must be freed afterwards").

For a MSG_ZEROCOPY skb carrying page-cache frags, SKBFL_SHARED_FRAG is
what makes esp_input() skb_cow_data() before in-place AEAD; once it is
stripped a later local ESP-in-UDP delivery decrypts in place over pages
the sender does not own -- an unprivileged page-cache write (the
"Fragnesia" primitive).
do_execute_actions() ignores output_userspace()'s return value, so any
action after a failed USERSPACE upcall inherits the stripped skb.

Move the skb_tx_error() to the flow-miss drop path - the "default"
branch of ovs_dp_process_packet()'s switch(error), before kfree_skb().

The call has been here since commit 36d5fe6a00 ("core, nfqueue,
openvswitch: Orphan frags in skb_zerocopy and handle errors") but was
harmless until esp_input() began relying on SKBFL_SHARED_FRAG to gate
in-place decrypt; only then did stripping it on a still-forwarded skb
become a page-cache write primitive.

Fixes: 36d5fe6a00 ("core, nfqueue, openvswitch: Orphan frags in skb_zerocopy and handle errors")
Fixes: f4c50a4034 ("xfrm: esp: avoid in-place decrypt on shared skb frags")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-5
Signed-off-by: Norbert Szetei <norbert@doyensec.com>
Reviewed-by: Ilya Maximets <i.maximets@ovn.org>
Tested-by: Jongmin Jang <payload.jang@gmail.com>
Link: https://patch.msgid.link/55A52703-7548-4A55-A9CE-2A37145BDCAD@doyensec.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-08-25 09:36:47 +02:00
..
actions.c net: openvswitch: fix skb leak on flow key update failure during ct 2026-07-29 17:42:33 -07:00
conntrack.c openvswitch: Fix CT limit teardown use-after-free 2026-08-24 11:38:09 -07:00
conntrack.h openvswitch: Fix CT limit teardown use-after-free 2026-08-24 11:38:09 -07:00
datapath.c openvswitch: only skb_tx_error() a packet we are about to drop 2026-08-25 09:36:47 +02:00
datapath.h openvswitch: Fix CT limit teardown use-after-free 2026-08-24 11:38:09 -07:00
dp_notify.c net: replace use of system_wq with system_percpu_wq 2025-09-22 17:40:30 -07:00
drop.h net: openvswitch: add misc error drop reasons 2023-08-14 08:01:06 +01:00
flow_netlink.c net: openvswitch: reject oversized nested action attrs 2026-07-11 13:09:11 +02:00
flow_netlink.h net: openvswitch: remove never-working support for setting nsh fields 2025-11-14 18:13:24 -08:00
flow_table.c net: use get_random_u{16,32,64}() where appropriate 2026-04-09 19:27:43 -07:00
flow_table.h net: openvswitch: Annotate struct mask_array with __counted_by 2023-10-17 13:56:03 +02:00
flow.c net/openvswitch: check Ethernet header length in key_extract() 2026-08-04 13:02:17 +02:00
flow.h net: openvswitch: reduce cpu_used_mask memory 2023-02-06 22:36:29 -08:00
Kconfig openvswitch: remove support for legacy tunnel types 2026-08-06 15:09:23 +02:00
Makefile openvswitch: remove support for legacy tunnel types 2026-08-06 15:09:23 +02:00
meter.c net: openvswitch: fix potential UAF on meter attach failure 2026-07-30 13:20:03 +02:00
meter.h net: openvswitch: remove unnecessary linux/genetlink.h include 2024-04-01 21:44:34 -07:00
openvswitch_trace.c openvswitch: add trace points 2021-06-22 10:47:32 -07:00
openvswitch_trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
vport-internal_dev.c net: rename netns_local to netns_immutable 2025-03-04 12:44:48 +01:00
vport-internal_dev.h
vport-netdev.c openvswitch: remove support for legacy tunnel types 2026-08-06 15:09:23 +02:00
vport-netdev.h openvswitch: remove support for legacy tunnel types 2026-08-06 15:09:23 +02:00
vport.c net: openvswitch: unexport ovs_vport_alloc/free 2026-08-13 18:33:35 -07:00
vport.h openvswitch: vport: remove infrastructure for separate modules 2026-08-06 15:09:23 +02:00