Skip to contentSkip to conversation

net: restore napi_consume_skb()'s NULL-handling

PATCH Applied Jakub Kicinski 3 participants 3 messages Nov 27, 2025 – Nov 28, 2025

Subsystems (2)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 net: restore napi_consume_skb()'s NULL-handling

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.

---
AI code review reported this on my bnxt patch..

---
 net/core/skbuff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/skbuff.c +1 -1
index 5a1d123e7ef7..a00808f7be6a 100644
@@ -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;
 	}
Signature · 1 line
2.51.1
#2 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Wed, 26 Nov 2025 17:43:11 -0800 you wrote:

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.

[...]

Here is the summary with links:
- [net-next] net: restore napi_consume_skb()'s NULL-handling

    https://git.kernel.org/netdev/net-next/c/4c03592689bc

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html