From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, eric.dumazet@gmail.com,
Eric Dumazet <edumazet@google.com>
Subject: [PATCH net-next 1/2] net: dropreason: add SKB_DROP_REASON_RECURSION_LIMIT
Date: Thu, 12 Mar 2026 20:18:23 +0000 [thread overview]
Message-ID: <20260312201824.203093-2-edumazet@google.com> (raw)
In-Reply-To: <20260312201824.203093-1-edumazet@google.com>
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>
---
include/net/dropreason-core.h | 3 +++
include/net/ip6_tunnel.h | 2 +-
net/ipv4/ip_tunnel_core.c | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h
index 5c8c2eb3d2c5b038683b78952106e374cf3b68d1..de61dd5dbfd9dc7d91d22d79a510d42fb69eb60a 100644
--- a/include/net/dropreason-core.h
+++ b/include/net/dropreason-core.h
@@ -123,6 +123,7 @@
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
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 359b595f1df93663b3e32c006d936427e8c8b20c..b99805ee2fd14bef6c7bc4daa6e8dfbc34984e4e 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -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;
}
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 5683c328990f49df2954af9d890b5f24150caeb2..f430d6f0463e7ab5761e98047a866d304a49abb2 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -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;
}
--
2.53.0.880.g73c4285caa-goog
next prev parent reply other threads:[~2026-03-12 20:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 20:18 [PATCH net-next 0/2] net: add SKB_DROP_REASON_RECURSION_LIMIT Eric Dumazet
2026-03-12 20:18 ` Eric Dumazet [this message]
2026-03-13 20:14 ` [PATCH net-next 1/2] net: dropreason: " Joe Damato
2026-03-12 20:18 ` [PATCH net-next 2/2] net: plumb drop reasons to __dev_queue_xmit() Eric Dumazet
2026-03-13 20:18 ` Joe Damato
2026-03-14 16:00 ` [PATCH net-next 0/2] net: add SKB_DROP_REASON_RECURSION_LIMIT patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260312201824.203093-2-edumazet@google.com \
--to=edumazet@google.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox