1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3 Date: Wed, 29 Apr 2020 14:59:21 -0600
4 Subject: [PATCH] wireguard: queueing: cleanup ptr_ring in error path of
7 commit 130c58606171326c81841a49cc913cd354113dd9 upstream.
9 Prior, if the alloc_percpu of packet_percpu_multicore_worker_alloc
10 failed, the previously allocated ptr_ring wouldn't be freed. This commit
11 adds the missing call to ptr_ring_cleanup in the error case.
13 Reported-by: Sultan Alsawaf <sultan@kerneltoast.com>
14 Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
15 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 Signed-off-by: David S. Miller <davem@davemloft.net>
17 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
19 drivers/net/wireguard/queueing.c | 4 +++-
20 1 file changed, 3 insertions(+), 1 deletion(-)
22 --- a/drivers/net/wireguard/queueing.c
23 +++ b/drivers/net/wireguard/queueing.c
24 @@ -35,8 +35,10 @@ int wg_packet_queue_init(struct crypt_qu
26 queue->worker = wg_packet_percpu_multicore_worker_alloc(
29 + if (!queue->worker) {
30 + ptr_ring_cleanup(&queue->ring, NULL);
34 INIT_WORK(&queue->work, function);