]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: add a debug check in __skb_push()
authorEric Dumazet <edumazet@google.com>
Fri, 30 Jan 2026 16:02:53 +0000 (16:02 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 3 Feb 2026 01:24:14 +0000 (17:24 -0800)
Add the following check, to detect bugs sooner for CONFIG_DEBUG_NET=y
builds.

DEBUG_NET_WARN_ON_ONCE(skb->data < skb->head);

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260130160253.2936789-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/skbuff.h

index e6bfe5d0c5252b2e7540e1fef9317aab83feced2..8b399ddf1b9bd0dddb37f417ccfa5ea675efafa3 100644 (file)
@@ -2813,6 +2813,7 @@ static inline void *__skb_push(struct sk_buff *skb, unsigned int len)
        DEBUG_NET_WARN_ON_ONCE(len > INT_MAX);
 
        skb->data -= len;
+       DEBUG_NET_WARN_ON_ONCE(skb->data < skb->head);
        skb->len  += len;
        return skb->data;
 }