diff options
author | Sabrina Dubroca <sd@queasysnail.net> | 2022-04-13 10:10:50 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-12 16:30:45 +0200 |
commit | 3defefd22ad5fbbe639b6157fb7e6311b2bf333d (patch) | |
tree | ca19c83abf7ca20d28f5cd0af287e07612c99d26 /include | |
parent | 49286fbdad47ecca61a4818e77bd0aced7f59383 (diff) | |
download | linux-stable-3defefd22ad5fbbe639b6157fb7e6311b2bf333d.tar.gz linux-stable-3defefd22ad5fbbe639b6157fb7e6311b2bf333d.tar.bz2 linux-stable-3defefd22ad5fbbe639b6157fb7e6311b2bf333d.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')
-rw-r--r-- | include/net/esp.h | 2 |
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) |