Commit 83571e9e authored by Eric Dumazet's avatar Eric Dumazet Committed by Greg Kroah-Hartman

gianfar: Do not reuse pages from emergency reserve


[ Upstream commit 69fed99b ]

A driver using dev_alloc_page() must not reuse a page that had to
use emergency memory reserve.

Otherwise all packets using this page will be immediately dropped,
unless for very specific sockets having SOCK_MEMALLOC bit set.

This issue might be hard to debug, because only a fraction of the RX
ring buffer would suffer from drops.

Fixes: 75354148 ("gianfar: Add paged allocation and Rx S/G")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Claudiu Manoil <claudiu.manoil@freescale.com>
Acked-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c48a862c
...@@ -2951,7 +2951,7 @@ static bool gfar_add_rx_frag(struct gfar_rx_buff *rxb, u32 lstatus, ...@@ -2951,7 +2951,7 @@ static bool gfar_add_rx_frag(struct gfar_rx_buff *rxb, u32 lstatus,
} }
/* try reuse page */ /* try reuse page */
if (unlikely(page_count(page) != 1)) if (unlikely(page_count(page) != 1 || page_is_pfmemalloc(page)))
return false; return false;
/* change offset to the other half */ /* change offset to the other half */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment