diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-09-19 06:04:01 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-09-19 06:15:27 +0200 |
commit | 4015e4a15bc45bfb8384a696e4b1795e0c4da284 (patch) | |
tree | 6fe97e97632c8b2b33497d561d22b0ad64d8be48 | |
parent | c3cbac06f54099bf75773419f38e3b48bfdcd45f (diff) |
send: don't take uninitialized lock
Packets is a local, which means we need to use the functions that don't
take a spinlock, since otherwise we'll be using a spinlock in an
undefined state.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/send.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -231,7 +231,7 @@ static void packet_create_data(struct wireguard_peer *peer, struct sk_buff_head ctx = kmem_cache_alloc(crypt_ctx_cache, GFP_ATOMIC); if (unlikely(!ctx)) { - skb_queue_purge(packets); + __skb_queue_purge(packets); goto err_drop_refs; } /* This function consumes the passed references to peer and keypair. */ @@ -243,7 +243,7 @@ static void packet_create_data(struct wireguard_peer *peer, struct sk_buff_head if (likely(queue_enqueue_per_device_and_peer(&wg->encrypt_queue, &peer->tx_queue, ctx, wg->packet_crypt_wq, &wg->encrypt_queue.last_cpu))) return; /* Successful. No need to fall through to drop references below. */ - skb_queue_purge(&ctx->packets); + __skb_queue_purge(&ctx->packets); kmem_cache_free(crypt_ctx_cache, ctx); err_drop_refs: @@ -288,7 +288,7 @@ void packet_send_staged_packets(struct wireguard_peer *peer) goto out_invalid; } - /* We pass off our peer and keypair references too the data subsystem and return. */ + /* We pass off our peer and keypair references to the data subsystem and return. */ packet_create_data(peer_rcu_get(peer), &packets, keypair); return; |