milos-linux/net/openvswitch
Adrian Moreno ee30dd2909 net: openvswitch: fix possible kfree_skb of ERR_PTR
After the patch in the "Fixes" tag, the allocation of the "reply" skb
can happen either before or after locking the ovs_mutex.

However, error cleanups still follow the classical reversed order,
assuming "reply" is allocated before locking: it is freed after unlocking.

If "reply" allocation happens after locking the mutex and it fails,
"reply" is left with an ERR_PTR, and execution jumps to the correspondent
cleanup stage which will try to free an invalid pointer.

Fix this by setting the pointer to NULL after having saved its error
value.

Fixes: 893f139b9a ("openvswitch: Minimize ovs_flow_cmd_new|set critical sections.")
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Aaron Conole <aconole@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Link: https://patch.msgid.link/20260604121946.942164-1-amorenoz@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-06-08 20:13:02 -07:00
..
actions.c net: convert remaining ipv6_stub users to direct function calls 2026-03-29 11:21:23 -07:00
conntrack.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
conntrack.h
datapath.c net: openvswitch: fix possible kfree_skb of ERR_PTR 2026-06-08 20:13:02 -07:00
datapath.h net: openvswitch: allow providing upcall pid for the 'execute' command 2025-07-07 14:30:39 -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
flow.c net: openvswitch: Use for_each_cpu() where appropriate 2025-08-20 19:47:22 -07:00
flow.h
flow_netlink.c openvswitch: validate MPLS set/set_masked payload length 2026-03-20 18:37:31 -07: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
Kconfig sctp: use skb_crc32c() instead of __skb_checksum() 2025-05-21 15:40:16 -07:00
Makefile
meter.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
meter.h
openvswitch_trace.c
openvswitch_trace.h
vport-geneve.c openvswitch: vport: fix race between tunnel creation and linking 2026-05-05 15:14:33 +02:00
vport-gre.c openvswitch: vport: fix race between tunnel creation and linking 2026-05-05 15:14:33 +02:00
vport-internal_dev.c
vport-internal_dev.h
vport-netdev.c openvswitch: vport: fix race between linking and the device notifier 2026-05-18 16:38:45 -07:00
vport-netdev.h openvswitch: vport: fix race between tunnel creation and linking 2026-05-05 15:14:33 +02:00
vport-vxlan.c openvswitch: vport: fix race between tunnel creation and linking 2026-05-05 15:14:33 +02:00
vport.c openvswitch: cap upcall PID array size and pre-size vport replies 2026-04-20 11:43:04 -07:00
vport.h