kernel: 5.4: import wireguard backport
[openwrt/openwrt.git] / target / linux / generic / backport-5.4 / 080-wireguard-0089-wireguard-socket-remove-extra-call-to-synchronize_ne.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3 Date: Fri, 14 Feb 2020 23:57:23 +0100
4 Subject: [PATCH] wireguard: socket: remove extra call to synchronize_net
5
6 commit 1fbc33b0a7feb6ca72bf7dc8a05d81485ee8ee2e upstream.
7
8 synchronize_net() is a wrapper around synchronize_rcu(), so there's no
9 point in having synchronize_net and synchronize_rcu back to back,
10 despite the documentation comment suggesting maybe it's somewhat useful,
11 "Wait for packets currently being received to be done." This commit
12 removes the extra call.
13
14 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
15 Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
16 Reviewed-by: Eric Dumazet <edumazet@google.com>
17 Signed-off-by: David S. Miller <davem@davemloft.net>
18 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
19 ---
20 drivers/net/wireguard/socket.c | 1 -
21 1 file changed, 1 deletion(-)
22
23 --- a/drivers/net/wireguard/socket.c
24 +++ b/drivers/net/wireguard/socket.c
25 @@ -432,7 +432,6 @@ void wg_socket_reinit(struct wg_device *
26 wg->incoming_port = ntohs(inet_sk(new4)->inet_sport);
27 mutex_unlock(&wg->socket_update_lock);
28 synchronize_rcu();
29 - synchronize_net();
30 sock_free(old4);
31 sock_free(old6);
32 }