aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/device.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-11-17 11:48:18 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2017-11-17 11:48:18 +0100
commitc3a04fe28e269e03ed2f31b7b349d3891042c0d5 (patch)
treef67fadd935676357e6a266f9d33b22f1cfb7e0f0 /src/device.c
parentsocket: only free socket after successful creation of new (diff)
downloadwireguard-monolithic-historical-c3a04fe28e269e03ed2f31b7b349d3891042c0d5.tar.xz
wireguard-monolithic-historical-c3a04fe28e269e03ed2f31b7b349d3891042c0d5.zip
device: uninitialize socket first in destruction
Diffstat (limited to '')
-rw-r--r--src/device.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/device.c b/src/device.c
index 12c11fb..1b3ab4f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -208,8 +208,9 @@ static void destruct(struct net_device *dev)
list_del(&wg->device_list);
rtnl_unlock();
mutex_lock(&wg->device_update_lock);
- peer_remove_all(wg); /* The final references are cleared in the below calls to destroy_workqueue. */
wg->incoming_port = 0;
+ socket_reinit(wg, NULL, NULL);
+ peer_remove_all(wg); /* The final references are cleared in the below calls to destroy_workqueue. */
destroy_workqueue(wg->handshake_receive_wq);
destroy_workqueue(wg->handshake_send_wq);
packet_queue_free(&wg->decrypt_queue, true);
@@ -220,7 +221,6 @@ static void destruct(struct net_device *dev)
ratelimiter_uninit();
memzero_explicit(&wg->static_identity, sizeof(struct noise_static_identity));
skb_queue_purge(&wg->incoming_handshakes);
- socket_reinit(wg, NULL, NULL);
free_percpu(dev->tstats);
free_percpu(wg->incoming_handshakes_worker);
if (wg->have_creating_net_ref)