aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit971b2cc00e0a3c55e8811c0158aa8a76548d6eb8 (patch)
treeb0f1ddab5890fb6adb8bc6277dcff3fb97176892
parentdata: use KMEM_CACHE macro (diff)
downloadwireguard-monolithic-historical-971b2cc00e0a3c55e8811c0158aa8a76548d6eb8.tar.xz
wireguard-monolithic-historical-971b2cc00e0a3c55e8811c0158aa8a76548d6eb8.zip
data: simplify no-keypair failure case
Signed-off-by: Samuel Holland <samuel@sholland.org>
-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)