]> git.baikalelectronics.ru Git - kernel.git/commit
sock: skb_copy_ubufs support for compound pages
authorWillem de Bruijn <willemb@google.com>
Thu, 3 Aug 2017 20:29:38 +0000 (16:29 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Aug 2017 04:37:29 +0000 (21:37 -0700)
commit682bacaaa89bfbf7405e1ce4e354669507ea60e7
treec18f48b0b880177bd081d3f365ce296b6f96f777
parente7d6460ea0913492811fd830a990f9796d13b4e2
sock: skb_copy_ubufs support for compound pages

Refine skb_copy_ubufs to support compound pages. With upcoming TCP
zerocopy sendmsg, such fragments may appear.

The existing code replaces each page one for one. Splitting each
compound page into an independent number of regular pages can result
in exceeding limit MAX_SKB_FRAGS if data is not exactly page aligned.

Instead, fill all destination pages but the last to PAGE_SIZE.
Split the existing alloc + copy loop into separate stages:
1. compute bytelength and minimum number of pages to store this.
2. allocate
3. copy, filling each page except the last to PAGE_SIZE bytes
4. update skb frag array

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h
net/core/skbuff.c