Netdev List
 help / color / mirror / Atom feed
* [PATCH 1/2 net-next] net: openvswitch: skip IPv4 later fragments on TCP/UDP set actions
@ 2026-10-15 12:47 Fernando Fernandez Mancera
  2026-10-15 12:47 ` [PATCH 2/2 net-next] net: openvswitch: drop IP fragments on SCTP set action Fernando Fernandez Mancera
  2026-10-15 12:53 ` [PATCH 1/2 net-next] net: openvswitch: skip IPv4 later fragments on TCP/UDP set actions netdev-bot+sinfo
  0 siblings, 2 replies; 3+ messages in thread
From: Fernando Fernandez Mancera @ 2026-10-15 12:47 UTC (permalink / raw)
  To: netdev
  Cc: dev, jesse, aatteka, horms, pabeni, kuba, edumazet, davem,
	i.maximets, echaudro, aconole, Fernando Fernandez Mancera

An IPv4 later fragment carries no L4 header, but key extraction leaves
ip.proto set to the real protocol and the flow may wildcard the frag
field, so validate_set() accepts such packets. set_tcp() and set_udp()
then treat the first bytes of the fragment payload as an L4 header,
rewrite them as ports and patch the bytes at the checksum offset,
corrupting the packet.

Skip these actions for OVS_FRAG_TYPE_LATER. IPv6 later fragments are not
affected, since their ip.proto is NEXTHDR_FRAGMENT and validate_set()
rejects L4 set actions for them.

Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
---
 net/openvswitch/actions.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 27152bca8a8c..4aade471afc4 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -595,6 +595,9 @@ static int set_udp(struct sk_buff *skb, struct sw_flow_key *flow_key,
 	__be16 src, dst;
 	int err;
 
+	if (flow_key->ip.frag == OVS_FRAG_TYPE_LATER)
+		return 0;
+
 	err = skb_ensure_writable(skb, skb_transport_offset(skb) +
 				  sizeof(struct udphdr));
 	if (unlikely(err))
@@ -638,6 +641,9 @@ static int set_tcp(struct sk_buff *skb, struct sw_flow_key *flow_key,
 	__be16 src, dst;
 	int err;
 
+	if (flow_key->ip.frag == OVS_FRAG_TYPE_LATER)
+		return 0;
+
 	err = skb_ensure_writable(skb, skb_transport_offset(skb) +
 				  sizeof(struct tcphdr));
 	if (unlikely(err))
-- 
2.55.0


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

end of thread, other threads:[~2026-10-15 12:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15 12:47 [PATCH 1/2 net-next] net: openvswitch: skip IPv4 later fragments on TCP/UDP set actions Fernando Fernandez Mancera
2026-10-15 12:47 ` [PATCH 2/2 net-next] net: openvswitch: drop IP fragments on SCTP set action Fernando Fernandez Mancera
2026-10-15 12:53 ` [PATCH 1/2 net-next] net: openvswitch: skip IPv4 later fragments on TCP/UDP set actions netdev-bot+sinfo

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