[PATCH net v3 0/2] net: do not run out of frags in alloc_skb_with_frags()

From
Haishuang Yan <hidden>
Date
2026-11-16 03:56:53
Also in
lkml
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@cmss.chinamobile.com/ (local)


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


Thread (6 messages) 6 messages, 2 authors, last reply 1d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help