[PATCH net v3 0/2] net: do not run out of frags in alloc_skb_with_frags()
From: Haishuang Yan
Date: Sun Nov 15 2026 - 22:57:00 EST
alloc_skb_with_frags() can fail with -ENOBUFS for a data_len that passed
its size check. Patch 1 fixes it, patch 2 adds a KUnit test.
The issues were found with the help of an AI coding assistant.
Changes in v3:
- Patch 1: check the frags left only after a failed allocation, with a
shift (Eric).
- Patch 1: say that the allocation still fails if the retry fails.
- Patch 2: skip only if MAX_SKB_FRAGS - 1 order-3 pages can't be held
at once; one page was nearly always available (netdev AI review).
- Shorter changelogs (Eric).
v2: https://lore.kernel.org/netdev/20261110162418.28322-1-yanhaishuang@xxxxxxxxxxxxxxxxxxxx/
Haishuang Yan (2):
net: do not run out of frags in alloc_skb_with_frags()
net: add a KUnit test for the alloc_skb_with_frags() tail split
net/core/net_test.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
net/core/skbuff.c | 33 ++++++++++++++++++++++++-----
2 files changed, 79 insertions(+), 5 deletions(-)
base-commit: a45dbf182137275f44ad7c8bc8acd23f7af6b2cf
--
2.43.0