summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Baron <jbaron@akamai.com>2025-09-22 15:19:57 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-02 13:42:51 +0200
commit31ae2fbc9fcb938b798a8f8fb61f6c54b9e79f59 (patch)
tree4290e1ad90ca45a26724f61e5013d40d998dc2a0
parent98a76bd96f382f3b571a8fdd247fc96d66dad7eb (diff)
downloadlinux-31ae2fbc9fcb938b798a8f8fb61f6c54b9e79f59.tar.gz
linux-31ae2fbc9fcb938b798a8f8fb61f6c54b9e79f59.tar.bz2
linux-31ae2fbc9fcb938b798a8f8fb61f6c54b9e79f59.zip
net: allow alloc_skb_with_frags() to use MAX_SKB_FRAGS
[ Upstream commit ca9f9cdc4de97d0221100b11224738416696163c ] Currently, alloc_skb_with_frags() will only fill (MAX_SKB_FRAGS - 1) slots. I think it should use all MAX_SKB_FRAGS slots, as callers of alloc_skb_with_frags() will size their allocation of frags based on MAX_SKB_FRAGS. This issue was discovered via a test patch that sets 'order' to 0 in alloc_skb_with_frags(), which effectively tests/simulates high fragmentation. In this case sendmsg() on unix sockets will fail every time for large allocations. If the PAGE_SIZE is 4K, then data_len will request 68K or 17 pages, but alloc_skb_with_frags() can only allocate 64K in this case or 16 pages. Fixes: 09c2c90705bb ("net: allow alloc_skb_with_frags() to allocate bigger packets") Signed-off-by: Jason Baron <jbaron@akamai.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20250922191957.2855612-1-jbaron@akamai.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/core/skbuff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 21a83e26f004..867832f8bbae 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -6330,7 +6330,7 @@ struct sk_buff *alloc_skb_with_frags(unsigned long header_len,
return NULL;
while (data_len) {
- if (nr_frags == MAX_SKB_FRAGS - 1)
+ if (nr_frags == MAX_SKB_FRAGS)
goto failure;
while (order && PAGE_ALIGN(data_len) < (PAGE_SIZE << order))
order--;