kernel: 5.4: import wireguard backport
[openwrt/openwrt.git] / target / linux / generic / backport-5.4 / 080-wireguard-0079-wireguard-queueing-do-not-account-for-pfmemalloc-whe.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3 Date: Thu, 2 Jan 2020 17:47:50 +0100
4 Subject: [PATCH] wireguard: queueing: do not account for pfmemalloc when
5 clearing skb header
6
7 commit 04d2ea92a18417619182cbb79063f154892b0150 upstream.
8
9 Before 8b7008620b84 ("net: Don't copy pfmemalloc flag in __copy_skb_
10 header()"), the pfmemalloc flag used to be between headers_start and
11 headers_end, which is a region we clear when preparing the packet for
12 encryption/decryption. This is a parameter we certainly want to
13 preserve, which is why 8b7008620b84 moved it out of there. The code here
14 was written in a world before 8b7008620b84, though, where we had to
15 manually account for it. This commit brings things up to speed.
16
17 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
20 ---
21 drivers/net/wireguard/queueing.h | 3 ---
22 1 file changed, 3 deletions(-)
23
24 --- a/drivers/net/wireguard/queueing.h
25 +++ b/drivers/net/wireguard/queueing.h
26 @@ -83,13 +83,10 @@ static inline __be16 wg_skb_examine_untr
27
28 static inline void wg_reset_packet(struct sk_buff *skb)
29 {
30 - const int pfmemalloc = skb->pfmemalloc;
31 -
32 skb_scrub_packet(skb, true);
33 memset(&skb->headers_start, 0,
34 offsetof(struct sk_buff, headers_end) -
35 offsetof(struct sk_buff, headers_start));
36 - skb->pfmemalloc = pfmemalloc;
37 skb->queue_mapping = 0;
38 skb->nohdr = 0;
39 skb->peeked = 0;