summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-06-16 00:59:16 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2017-07-20 03:37:39 +0200
commit86c2ff8aa8397a004cd78cfec45e1ab535152345 (patch)
treeb2ba88b8b09b3cd3939b7f0e34dfa39062a0f523 /src
parenta3a3a553249f7d870ae625f3e66f4b93f7fa4c90 (diff)
data: simplify no-keypair failure case
Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rw-r--r--src/data.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/data.c b/src/data.c
index 0ee5595..fb91861 100644
--- a/src/data.c
+++ b/src/data.c
@@ -275,9 +275,9 @@ int packet_create_data(struct sk_buff_head *queue, struct wireguard_peer *peer)
rcu_read_lock_bh();
keypair = noise_keypair_get(rcu_dereference_bh(peer->keypairs.current_keypair));
- if (unlikely(!keypair))
- goto err_rcu;
rcu_read_unlock_bh();
+ if (unlikely(!keypair))
+ return ret;
skb_queue_walk (queue, skb) {
if (unlikely(!get_encryption_nonce(&PACKET_CB(skb)->nonce, &keypair->sending)))
@@ -328,9 +328,6 @@ serial_encrypt:
err:
noise_keypair_put(keypair);
return ret;
-err_rcu:
- rcu_read_unlock_bh();
- return ret;
}
static void begin_decrypt_packet(struct decryption_ctx *ctx)