linux-yocto/net/openvswitch
Faicker Mo 69541e5832 net: openvswitch: Fix the dead loop of MPLS parse
[ Upstream commit 0bdc924bfb ]

The unexpected MPLS packet may not end with the bottom label stack.
When there are many stacks, The label count value has wrapped around.
A dead loop occurs, soft lockup/CPU stuck finally.

stack backtrace:
UBSAN: array-index-out-of-bounds in /build/linux-0Pa0xK/linux-5.15.0/net/openvswitch/flow.c:662:26
index -1 is out of range for type '__be32 [3]'
CPU: 34 PID: 0 Comm: swapper/34 Kdump: loaded Tainted: G           OE   5.15.0-121-generic #131-Ubuntu
Hardware name: Dell Inc. PowerEdge C6420/0JP9TF, BIOS 2.12.2 07/14/2021
Call Trace:
 <IRQ>
 show_stack+0x52/0x5c
 dump_stack_lvl+0x4a/0x63
 dump_stack+0x10/0x16
 ubsan_epilogue+0x9/0x36
 __ubsan_handle_out_of_bounds.cold+0x44/0x49
 key_extract_l3l4+0x82a/0x840 [openvswitch]
 ? kfree_skbmem+0x52/0xa0
 key_extract+0x9c/0x2b0 [openvswitch]
 ovs_flow_key_extract+0x124/0x350 [openvswitch]
 ovs_vport_receive+0x61/0xd0 [openvswitch]
 ? kernel_init_free_pages.part.0+0x4a/0x70
 ? get_page_from_freelist+0x353/0x540
 netdev_port_receive+0xc4/0x180 [openvswitch]
 ? netdev_port_receive+0x180/0x180 [openvswitch]
 netdev_frame_hook+0x1f/0x40 [openvswitch]
 __netif_receive_skb_core.constprop.0+0x23a/0xf00
 __netif_receive_skb_list_core+0xfa/0x240
 netif_receive_skb_list_internal+0x18e/0x2a0
 napi_complete_done+0x7a/0x1c0
 bnxt_poll+0x155/0x1c0 [bnxt_en]
 __napi_poll+0x30/0x180
 net_rx_action+0x126/0x280
 ? bnxt_msix+0x67/0x80 [bnxt_en]
 handle_softirqs+0xda/0x2d0
 irq_exit_rcu+0x96/0xc0
 common_interrupt+0x8e/0xa0
 </IRQ>

Fixes: fbdcdd78da ("Change in Openvswitch to support MPLS label depth of 3 in ingress direction")
Signed-off-by: Faicker Mo <faicker.mo@zenlayer.com>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Reviewed-by: Aaron Conole <aconole@redhat.com>
Link: https://patch.msgid.link/259D3404-575D-4A6D-B263-1DF59A67CF89@zenlayer.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-19 15:31:55 +02:00
..
actions.c openvswitch: Fix unsafe attribute parsing in output_userspace() 2025-05-18 08:24:47 +02:00
conntrack.c Revert "openvswitch: switch to per-action label counting in conntrack" 2025-03-22 12:54:13 -07:00
conntrack.h
datapath.c openvswitch: use RCU protection in ovs_vport_cmd_fill_info() 2025-02-21 14:01:43 +01:00
datapath.h Revert "openvswitch: switch to per-action label counting in conntrack" 2025-03-22 12:54:13 -07:00
dp_notify.c
drop.h
flow_netlink.c net: openvswitch: fix nested key length validation in the set() action 2025-04-25 10:47:43 +02:00
flow_netlink.h
flow_table.c
flow_table.h
flow.c net: openvswitch: Fix the dead loop of MPLS parse 2025-06-19 15:31:55 +02:00
flow.h
Kconfig net: openvswitch: add psample action 2024-07-05 17:45:47 -07:00
Makefile
meter.c
meter.h net: openvswitch: remove unnecessary linux/genetlink.h include 2024-04-01 21:44:34 -07:00
openvswitch_trace.c
openvswitch_trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
vport-geneve.c
vport-gre.c
vport-internal_dev.c netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local 2024-09-03 11:36:43 +02:00
vport-internal_dev.h
vport-netdev.c net: openvswitch: Release reference to netdev 2024-04-24 17:07:17 -07:00
vport-netdev.h
vport-vxlan.c
vport.c net: openvswitch: store sampling probability in cb. 2024-07-05 17:45:47 -07:00
vport.h