* [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
* [PATCH 2/2 net-next] net: openvswitch: drop IP fragments on SCTP set action
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 ` 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
1 sibling, 0 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
The SCTP checksum is a CRC32c over the whole SCTP packet. set_sctp()
updates it as old_csum ^ old_correct_csum ^ new_csum, with the two CRCs
computed over the bytes of the current skb only. That is correct only
when the skb holds the whole SCTP packet. For a first fragment, and for
a later fragment, it holds just a part of it, and the CRC delta of a
change at the start of the packet depends on how many bytes follow, so
the checksum written is wrong. The receiver drops the reassembled
packet.
validate_set() accepts SCTP set action for any flow with ip.proto set to
SCTP, regardless of the fragmentation bits, as it only receives the
masked key. As the checksum cannot be fixed up without the whole
datagram, fail the action for packets that are IP fragments of either
family, so the packet is dropped with OVS_DROP_ACTION_ERROR instead of
being forwarded with modified ports and an invalid checksum.
Link: https://lore.kernel.org/netdev/d4fc14f3-4308-4560-9012-43c09c1b3845@ovn.org/
Fixes: a175a723301a ("openvswitch: Add SCTP support")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
---
net/openvswitch/actions.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 4aade471afc4..12e339cbf791 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -674,6 +674,9 @@ static int set_sctp(struct sk_buff *skb, struct sw_flow_key *flow_key,
__le32 old_correct_csum, new_csum, old_csum;
int err;
+ if (flow_key->ip.frag != OVS_FRAG_TYPE_NONE)
+ return -EINVAL;
+
err = skb_ensure_writable(skb, sctphoff + sizeof(struct sctphdr));
if (unlikely(err))
return err;
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2 net-next] net: openvswitch: skip IPv4 later fragments on TCP/UDP set actions
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 ` netdev-bot+sinfo
1 sibling, 0 replies; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-10-15 12:53 UTC (permalink / raw)
To: Fernando Fernandez Mancera
Cc: netdev, dev, jesse, aatteka, horms, pabeni, kuba, edumazet, davem,
i.maximets, echaudro, aconole
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by code inspection). If it was triggered please include
the symptoms, like the stack trace or error messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [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