linux/net
Ilya Maximets 7c988176b6 net: openvswitch: fix overwriting ct original tuple for ICMPv6
OVS_PACKET_CMD_EXECUTE has 3 main attributes:
 - OVS_PACKET_ATTR_KEY - Packet metadata in a netlink format.
 - OVS_PACKET_ATTR_PACKET - Binary packet content.
 - OVS_PACKET_ATTR_ACTIONS - Actions to execute on the packet.

OVS_PACKET_ATTR_KEY is parsed first to populate sw_flow_key structure
with the metadata like conntrack state, input port, recirculation id,
etc.  Then the packet itself gets parsed to populate the rest of the
keys from the packet headers.

Whenever the packet parsing code starts parsing the ICMPv6 header, it
first zeroes out fields in the key corresponding to Neighbor Discovery
information even if it is not an ND packet.

It is an 'ipv6.nd' field.  However, the 'ipv6' is a union that shares
the space between 'nd' and 'ct_orig' that holds the original tuple
conntrack metadata parsed from the OVS_PACKET_ATTR_KEY.

ND packets should not normally have conntrack state, so it's fine to
share the space, but normal ICMPv6 Echo packets or maybe other types of
ICMPv6 can have the state attached and it should not be overwritten.

The issue results in all but the last 4 bytes of the destination
address being wiped from the original conntrack tuple leading to
incorrect packet matching and potentially executing wrong actions
in case this packet recirculates within the datapath or goes back
to userspace.

ND fields should not be accessed in non-ND packets, so not clearing
them should be fine.  Executing memset() only for actual ND packets to
avoid the issue.

Initializing the whole thing before parsing is needed because ND packet
may not contain all the options.

The issue only affects the OVS_PACKET_CMD_EXECUTE path and doesn't
affect packets entering OVS datapath from network interfaces, because
in this case CT metadata is populated from skb after the packet is
already parsed.

Fixes: 9dd7f8907c ("openvswitch: Add original direction conntrack tuple to sw_flow_key.")
Reported-by: Antonin Bas <antonin.bas@broadcom.com>
Closes: https://github.com/openvswitch/ovs-issues/issues/327
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Link: https://lore.kernel.org/r/20240509094228.1035477-1-i.maximets@ovn.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-05-10 19:24:07 -07:00
..
6lowpan
9p
802
8021q net: gro: fix udp bad offset in socket lookup by adding {inner_}network_offset to napi_gro_cb 2024-05-02 11:02:48 +02:00
appletalk appletalk: Improve handling of broadcast packets 2024-05-08 12:17:19 +01:00
atm
ax25 ax25: Fix netdev refcount issue 2024-04-23 11:35:52 +02:00
batman-adv batman-adv: Avoid infinite loop trying to resize local TT 2024-03-29 20:18:43 +01:00
bluetooth Bluetooth: l2cap: fix null-ptr-deref in l2cap_chan_timeout 2024-05-03 13:05:54 -04:00
bpf for-netdev 2024-03-11 18:06:04 -07:00
bridge net: bridge: fix corrupted ethernet header on multicast-to-unicast 2024-05-08 10:37:57 +01:00
caif
can
ceph
core net: fix out-of-bounds access in ops_init 2024-05-06 13:38:14 +02:00
dcb
dccp Kbuild updates for v6.9 2024-03-21 14:41:00 -07:00
devlink devlink: fix port new reply cmd type 2024-03-19 19:37:57 -07:00
dns_resolver
dsa
ethernet ethernet: Add helper for assigning packet type when dest address does not match device address 2024-04-25 08:20:54 -07:00
ethtool
handshake
hsr hsr: Simplify code for announcing HSR nodes timer setup 2024-05-08 18:56:30 -07:00
ieee802154
ife
ipv4 ipsec-2024-05-02 2024-05-03 15:56:15 -07:00
ipv6 ipv6: prevent NULL dereference in ip6_output() 2024-05-08 18:57:12 -07:00
iucv more s390 updates for 6.9 merge window 2024-03-19 11:38:27 -07:00
kcm
key
l2tp net l2tp: drop flow hash on forward 2024-04-26 13:48:24 +02:00
l3mdev
lapb
llc
mac80211 wifi: mac80211: fix unaligned le16 access 2024-04-19 10:02:27 +02:00
mac802154
mctp
mpls - Kuan-Wei Chiu has developed the well-named series "lib min_heap: Min 2024-03-14 18:03:09 -07:00
mptcp mptcp: only allow set existing scheduler for net.mptcp.scheduler 2024-05-07 17:23:35 -07:00
ncsi
netfilter netfilter: nf_tables: honor table dormant flag from netdev release event path 2024-04-25 10:42:57 +02:00
netlabel
netlink
netrom
nfc nfc: nci: Fix kcov check in nci_rx_work() 2024-05-07 16:40:06 -07:00
nsh nsh: Restore skb->{protocol,data,mac_header} for outer header in nsh_gso_segment(). 2024-04-26 12:20:01 +02:00
openvswitch net: openvswitch: fix overwriting ct original tuple for ICMPv6 2024-05-10 19:24:07 -07:00
packet Revert "net: Re-use and set mono_delivery_time bit for userspace tstamp packets" 2024-03-18 12:29:53 +00:00
phonet phonet: fix rtm_phonet_notify() skb allocation 2024-05-06 18:30:00 -07:00
psample
qrtr
rds net/rds: fix possible cp null dereference 2024-03-29 12:04:09 -07:00
rfkill
rose
rxrpc rxrpc: Only transmit one ACK per jumbo packet received 2024-05-08 08:05:03 -07:00
sched net/sched: Fix mirred deadlock on device recursion 2024-04-17 18:22:52 -07:00
sctp
smc net/smc: fix neighbour and rtable leak in smc_ib_find_route() 2024-05-09 10:03:43 +02:00
strparser
sunrpc NFS client bugfixes for Linux 6.9 2024-04-29 12:07:37 -07:00
switchdev
tipc tipc: fix a possible memleak in tipc_buf_append 2024-05-01 18:39:44 -07:00
tls tls: fix lockless read of strp->msg_ready in ->poll 2024-04-25 08:32:37 -07:00
unix af_unix: Fix data races in unix_release_sock/unix_stream_sendmsg 2024-05-10 19:22:26 -07:00
vmw_vsock vsock/virtio: fix packet delivery to tap device 2024-04-02 18:00:24 -07:00
wireless wifi: nl80211: don't free NULL coalescing rule 2024-04-19 10:02:17 +02:00
x25
xdp xsk: validate user input for XDP_{UMEM|COMPLETION}_FILL_RING 2024-04-05 22:47:22 -07:00
xfrm xfrm: Preserve vlan tags for transport mode software GRO 2024-04-26 06:44:33 +02:00
compat.c
devres.c
Kconfig
Kconfig.debug
Makefile
socket.c net: remove {revc,send}msg_copy_msghdr() from exports 2024-03-14 16:48:53 -07:00
sysctl_net.c