[v3,net,4/4] wireguard: socket: remove extra call to synchronize_net
diff mbox series

Message ID 20200214225723.63646-5-Jason@zx2c4.com
State Accepted
Delegated to: David Miller
Headers show
Series
  • wireguard fixes for 5.6-rc2
Related show

Commit Message

Jason A. Donenfeld Feb. 14, 2020, 10:57 p.m. UTC
synchronize_net() is a wrapper around synchronize_rcu(), so there's no
point in having synchronize_net and synchronize_rcu back to back,
despite the documentation comment suggesting maybe it's somewhat useful,
"Wait for packets currently being received to be done." This commit
removes the extra call.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 drivers/net/wireguard/socket.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Eric Dumazet Feb. 14, 2020, 11:21 p.m. UTC | #1
On 2/14/20 2:57 PM, Jason A. Donenfeld wrote:
> synchronize_net() is a wrapper around synchronize_rcu(), so there's no
> point in having synchronize_net and synchronize_rcu back to back,
> despite the documentation comment suggesting maybe it's somewhat useful,
> "Wait for packets currently being received to be done." This commit
> removes the extra call.
> 
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>

Reviewed-by: Eric Dumazet <edumazet@google.com>

Thanks !

Patch
diff mbox series

diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c
index 262f3b5c819d..b0d6541582d3 100644
--- a/drivers/net/wireguard/socket.c
+++ b/drivers/net/wireguard/socket.c
@@ -432,7 +432,6 @@  void wg_socket_reinit(struct wg_device *wg, struct sock *new4,
 		wg->incoming_port = ntohs(inet_sk(new4)->inet_sport);
 	mutex_unlock(&wg->socket_update_lock);
 	synchronize_rcu();
-	synchronize_net();
 	sock_free(old4);
 	sock_free(old6);
 }