ovs_fragment() only handles IPv4 and IPv6 and drops any other packet
with a WARN_ONCE(). Since OVS_PACKET_CMD_EXECUTE takes the MRU from
userspace, any ethertype can get there, e.g. an MPLS packet executed by
an unprivileged user in its own user and network namespace:

  Failed fragment ->ovs0: eth=8847, MRU=500, MTU=1500.
  WARNING: net/openvswitch/actions.c:831 at ovs_fragment+0x239/0x840, CPU#1: 
test/106
  Call Trace:
   do_execute_actions+0x580e/0x7380
   ovs_execute_actions+0xd3/0x3e0
   ovs_packet_cmd_execute+0xc21/0x13c0

The packet is dropped either way, so use a rate-limited warning instead.

Fixes: 7f8a436eaa2c ("openvswitch: Add conntrack action")
Closes: 
https://lore.kernel.org/netdev/[email protected]/
Signed-off-by: Kyuwon Cho <[email protected]>
---
Aaron, here is the patch, with the rate-limited warning you suggested.
It was written with LLM assistance; we reviewed and tested it. With it
applied on net, the reproducer from the report prints the message
instead of warning.

 net/openvswitch/actions.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 12e339cbf791..bf3f2b328b53 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -828,9 +828,9 @@ static void ovs_fragment(struct net *net, struct vport 
*vport,
                ip6_fragment(net, skb->sk, skb, ovs_vport_output);
                refdst_drop(orig_dst);
        } else {
-               WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.",
-                         ovs_vport_name(vport), ntohs(key->eth.type), mru,
-                         vport->dev->mtu);
+               net_warn_ratelimited("Failed fragment ->%s: eth=%04x, MRU=%d, 
MTU=%d.\n",
+                                    ovs_vport_name(vport), 
ntohs(key->eth.type),
+                                    mru, vport->dev->mtu);
                reason = OVS_DROP_FRAG_INVALID_PROTO;
                goto err;
        }
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to