aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/queueing.h2
-rw-r--r--src/receive.c3
-rw-r--r--src/send.c3
3 files changed, 5 insertions, 3 deletions
diff --git a/src/queueing.h b/src/queueing.h
index 30df3a8..48607a1 100644
--- a/src/queueing.h
+++ b/src/queueing.h
@@ -52,10 +52,10 @@ struct crypt_ctx {
struct sk_buff_head packets;
struct sk_buff *skb;
};
+ atomic_t is_finished;
struct wireguard_peer *peer;
struct noise_keypair *keypair;
struct endpoint endpoint;
- atomic_t is_finished;
};
/* Returns either the correct skb->protocol value, or 0 if invalid. */
diff --git a/src/receive.c b/src/receive.c
index efe53f4..0f4545b 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -389,13 +389,14 @@ static void packet_consume_data(struct wireguard_device *wg, struct sk_buff *skb
return;
}
- ctx = kmem_cache_zalloc(crypt_ctx_cache, GFP_ATOMIC);
+ ctx = kmem_cache_alloc(crypt_ctx_cache, GFP_ATOMIC);
if (unlikely(!ctx)) {
dev_kfree_skb(skb);
peer_put(ctx->keypair->entry.peer);
noise_keypair_put(keypair);
return;
}
+ atomic_set(&ctx->is_finished, false);
ctx->keypair = keypair;
ctx->skb = skb;
/* We already have a reference to peer from index_hashtable_lookup. */
diff --git a/src/send.c b/src/send.c
index c725317..e9fe881 100644
--- a/src/send.c
+++ b/src/send.c
@@ -229,12 +229,13 @@ static void packet_create_data(struct wireguard_peer *peer, struct sk_buff_head
struct crypt_ctx *ctx;
struct wireguard_device *wg = peer->device;
- ctx = kmem_cache_zalloc(crypt_ctx_cache, GFP_ATOMIC);
+ ctx = kmem_cache_alloc(crypt_ctx_cache, GFP_ATOMIC);
if (unlikely(!ctx)) {
skb_queue_purge(packets);
goto err_drop_refs;
}
/* This function consumes the passed references to peer and keypair. */
+ atomic_set(&ctx->is_finished, false);
ctx->keypair = keypair;
ctx->peer = peer;
__skb_queue_head_init(&ctx->packets);