]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: dropreason: add SKB_DROP_REASON_RECURSION_LIMIT
authorEric Dumazet <edumazet@google.com>
Thu, 12 Mar 2026 20:18:23 +0000 (20:18 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sat, 14 Mar 2026 15:38:06 +0000 (08:38 -0700)
ip[6]tunnel_xmit() can drop packets if a too deep recursion level
is detected.

Add SKB_DROP_REASON_RECURSION_LIMIT drop reason.

We will use this reason later in __dev_queue_xmit().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Joe Damato <joe@dama.to>
Link: https://patch.msgid.link/20260312201824.203093-2-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/dropreason-core.h
include/net/ip6_tunnel.h
net/ipv4/ip_tunnel_core.c

index 5c8c2eb3d2c5b038683b78952106e374cf3b68d1..de61dd5dbfd9dc7d91d22d79a510d42fb69eb60a 100644 (file)
        FN(PFMEMALLOC)  \
        FN(PSP_INPUT)                   \
        FN(PSP_OUTPUT)                  \
+       FN(RECURSION_LIMIT)             \
        FNe(MAX)
 
 /**
@@ -582,6 +583,8 @@ enum skb_drop_reason {
        SKB_DROP_REASON_PSP_INPUT,
        /** @SKB_DROP_REASON_PSP_OUTPUT: PSP output checks failed */
        SKB_DROP_REASON_PSP_OUTPUT,
+       /** @SKB_DROP_REASON_RECURSION_LIMIT: Dead loop on virtual device. */
+       SKB_DROP_REASON_RECURSION_LIMIT,
        /**
         * @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which
         * shouldn't be used as a real 'reason' - only for tracing code gen
index 359b595f1df93663b3e32c006d936427e8c8b20c..b99805ee2fd14bef6c7bc4daa6e8dfbc34984e4e 100644 (file)
@@ -162,7 +162,7 @@ static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
                                             dev->name);
                        DEV_STATS_INC(dev, tx_errors);
                }
-               kfree_skb(skb);
+               kfree_skb_reason(skb, SKB_DROP_REASON_RECURSION_LIMIT);
                return;
        }
 
index 5683c328990f49df2954af9d890b5f24150caeb2..f430d6f0463e7ab5761e98047a866d304a49abb2 100644 (file)
@@ -65,7 +65,7 @@ void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
                        DEV_STATS_INC(dev, tx_errors);
                }
                ip_rt_put(rt);
-               kfree_skb(skb);
+               kfree_skb_reason(skb, SKB_DROP_REASON_RECURSION_LIMIT);
                return;
        }