From 4015e4a15bc45bfb8384a696e4b1795e0c4da284 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 19 Sep 2017 06:04:01 +0200 Subject: 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 --- src/send.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/send.c b/src/send.c index e9fe881..107e5f6 100644 --- a/src/send.c +++ b/src/send.c @@ -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; -- cgit v1.2.3