Skip to content

Commit ca9f9cd

Browse files
almostivankuba-moo
authored andcommitted
net: allow alloc_skb_with_frags() to use MAX_SKB_FRAGS
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: 09c2c90 ("net: allow alloc_skb_with_frags() to allocate bigger packets") Signed-off-by: Jason Baron <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 16d9355 commit ca9f9cd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/core/skbuff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6667,7 +6667,7 @@ struct sk_buff *alloc_skb_with_frags(unsigned long header_len,
66676667
return NULL;
66686668

66696669
while (data_len) {
6670-
if (nr_frags == MAX_SKB_FRAGS - 1)
6670+
if (nr_frags == MAX_SKB_FRAGS)
66716671
goto failure;
66726672
while (order && PAGE_ALIGN(data_len) < (PAGE_SIZE << order))
66736673
order--;

0 commit comments

Comments
 (0)