mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-11 02:59:12 +00:00
net: Do not allocate page fragments that are not skb aligned
[ Upstream commit3bed3cc415
] This patch addresses the fact that there are drivers, specifically tun, that will call into the network page fragment allocators with buffer sizes that are not cache aligned. Doing this could result in data alignment and DMA performance issues as these fragment pools are also shared with the skb allocator and any other devices that will use napi_alloc_frags or netdev_alloc_frags. Fixes:ffde7328a3
("net: Split netdev_alloc_frag into __alloc_page_frag and add __napi_alloc_frag") Reported-by: Jann Horn <jannh@google.com> Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1bdb1675f3
commit
718ccdb3ea
1 changed files with 4 additions and 0 deletions
|
@ -353,6 +353,8 @@ static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
|
|||
*/
|
||||
void *netdev_alloc_frag(unsigned int fragsz)
|
||||
{
|
||||
fragsz = SKB_DATA_ALIGN(fragsz);
|
||||
|
||||
return __netdev_alloc_frag(fragsz, GFP_ATOMIC);
|
||||
}
|
||||
EXPORT_SYMBOL(netdev_alloc_frag);
|
||||
|
@ -366,6 +368,8 @@ static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
|
|||
|
||||
void *napi_alloc_frag(unsigned int fragsz)
|
||||
{
|
||||
fragsz = SKB_DATA_ALIGN(fragsz);
|
||||
|
||||
return __napi_alloc_frag(fragsz, GFP_ATOMIC);
|
||||
}
|
||||
EXPORT_SYMBOL(napi_alloc_frag);
|
||||
|
|
Loading…
Reference in a new issue