summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2022-04-13 10:10:50 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-12 16:29:00 +0200
commitef6f83df1209a7d9bd1c605a62457d4c00f9179e (patch)
tree3bc7f974b56f15d8b0bb3db48325b53b6080078d /include/net
parent2283d8a4ecbe13573fad833f4ed6805f72446b2f (diff)
downloadlinux-stable-ef6f83df1209a7d9bd1c605a62457d4c00f9179e.tar.gz
linux-stable-ef6f83df1209a7d9bd1c605a62457d4c00f9179e.tar.bz2
linux-stable-ef6f83df1209a7d9bd1c605a62457d4c00f9179e.zip
esp: limit skb_page_frag_refill use to a single page
commit 5bd8baab087dff657e05387aee802e70304cc813 upstream. Commit ebe48d368e97 ("esp: Fix possible buffer overflow in ESP transformation") tried to fix skb_page_frag_refill usage in ESP by capping allocsize to 32k, but that doesn't completely solve the issue, as skb_page_frag_refill may return a single page. If that happens, we will write out of bounds, despite the check introduced in the previous patch. This patch forces COW in cases where we would end up calling skb_page_frag_refill with a size larger than a page (first in esp_output_head with tailen, then in esp_output_tail with skb->data_len). Fixes: cac2661c53f3 ("esp4: Avoid skb_cow_data whenever possible") Fixes: 03e2a30f6a27 ("esp6: Avoid skb_cow_data whenever possible") Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/esp.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/include/net/esp.h b/include/net/esp.h
index 465e38890ee9..117652eb6ea3 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -4,8 +4,6 @@
#include <linux/skbuff.h>
-#define ESP_SKB_FRAG_MAXSIZE (PAGE_SIZE << SKB_FRAG_PAGE_ORDER)
-
struct ip_esp_hdr;
static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)