]> Gentwo Git Trees - linux/.git/commitdiff
net: restore napi_consume_skb()'s NULL-handling
authorJakub Kicinski <kuba@kernel.org>
Thu, 27 Nov 2025 01:43:11 +0000 (17:43 -0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 28 Nov 2025 01:44:22 +0000 (17:44 -0800)
Commit e20dfbad8aab ("net: fix napi_consume_skb() with alien skbs")
added a skb->cpu check to napi_consume_skb(), before the point where
napi_consume_skb() validated skb is not NULL.

Add an explicit check to the early exit condition.

Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/skbuff.c

index 5a1d123e7ef748220cfe9b54f317d05e75027ce8..a00808f7be6a1b86c595183f8b131996e3d0afcc 100644 (file)
@@ -1490,7 +1490,7 @@ void napi_skb_free_stolen_head(struct sk_buff *skb)
 void napi_consume_skb(struct sk_buff *skb, int budget)
 {
        /* Zero budget indicate non-NAPI context called us, like netpoll */
-       if (unlikely(!budget)) {
+       if (unlikely(!budget || !skb)) {
                dev_consume_skb_any(skb);
                return;
        }