diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-27 03:37:31 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-31 17:25:23 +0100 |
commit | 86e06a3d856c7c09fcdea63ff76c8a8c4db7463d (patch) | |
tree | 29edb144f721bca57f8941d8a02834eec417d188 /src/device.c | |
parent | global: get rid of useless forward declarations (diff) | |
download | wireguard-monolithic-historical-86e06a3d856c7c09fcdea63ff76c8a8c4db7463d.tar.xz wireguard-monolithic-historical-86e06a3d856c7c09fcdea63ff76c8a8c4db7463d.zip |
device: expand scope of destruct lock
Diffstat (limited to '')
-rw-r--r-- | src/device.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/device.c b/src/device.c index 2bdbfd9..8195611 100644 --- a/src/device.c +++ b/src/device.c @@ -204,10 +204,10 @@ static void destruct(struct net_device *dev) { struct wireguard_device *wg = netdev_priv(dev); + mutex_lock(&wg->device_update_lock); rtnl_lock(); 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; destroy_workqueue(wg->handshake_receive_wq); @@ -220,11 +220,11 @@ static void destruct(struct net_device *dev) memzero_explicit(&wg->static_identity, sizeof(struct noise_static_identity)); skb_queue_purge(&wg->incoming_handshakes); socket_uninit(wg); - mutex_unlock(&wg->device_update_lock); free_percpu(dev->tstats); free_percpu(wg->incoming_handshakes_worker); if (wg->have_creating_net_ref) put_net(wg->creating_net); + mutex_unlock(&wg->device_update_lock); pr_debug("%s: Interface deleted\n", dev->name); free_netdev(dev); |