All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>, stable@vger.kernel.org
Subject: [PATCH net 6/9] wireguard: allowedips: initialize list head in selftest
Date: Fri,  4 Jun 2021 17:17:35 +0200	[thread overview]
Message-ID: <20210604151738.220232-7-Jason@zx2c4.com> (raw)
In-Reply-To: <20210604151738.220232-1-Jason@zx2c4.com>

The randomized trie tests weren't initializing the dummy peer list head,
resulting in a NULL pointer dereference when used. Fix this by
initializing it in the randomized trie test, just like we do for the
static unit test.

While we're at it, all of the other strings like this have the word
"self-test", so add it to the missing place here.

Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
Cc: stable@vger.kernel.org
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/net/wireguard/selftest/allowedips.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireguard/selftest/allowedips.c b/drivers/net/wireguard/selftest/allowedips.c
index 846db14cb046..0d2a43a2d400 100644
--- a/drivers/net/wireguard/selftest/allowedips.c
+++ b/drivers/net/wireguard/selftest/allowedips.c
@@ -296,6 +296,7 @@ static __init bool randomized_test(void)
 			goto free;
 		}
 		kref_init(&peers[i]->refcount);
+		INIT_LIST_HEAD(&peers[i]->allowedips_list);
 	}
 
 	mutex_lock(&mutex);
@@ -333,7 +334,7 @@ static __init bool randomized_test(void)
 			if (wg_allowedips_insert_v4(&t,
 						    (struct in_addr *)mutated,
 						    cidr, peer, &mutex) < 0) {
-				pr_err("allowedips random malloc: FAIL\n");
+				pr_err("allowedips random self-test malloc: FAIL\n");
 				goto free_locked;
 			}
 			if (horrible_allowedips_insert_v4(&h,
-- 
2.31.1


  parent reply	other threads:[~2021-06-04 15:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04 15:17 [PATCH net 0/9] wireguard fixes for 5.13-rc5 Jason A. Donenfeld
2021-06-04 15:17 ` [PATCH net 1/9] wireguard: selftests: remove old conntrack kconfig value Jason A. Donenfeld
2021-06-04 15:17 ` [PATCH net 2/9] wireguard: selftests: make sure rp_filter is disabled on vethc Jason A. Donenfeld
2021-06-04 15:17 ` [PATCH net 3/9] wireguard: do not use -O3 Jason A. Donenfeld
2021-06-04 15:17 ` [PATCH net 4/9] wireguard: use synchronize_net rather than synchronize_rcu Jason A. Donenfeld
2021-06-04 15:17 ` [PATCH net 5/9] wireguard: peer: allocate in kmem_cache Jason A. Donenfeld
2021-06-04 15:17 ` Jason A. Donenfeld [this message]
2021-06-04 15:17 ` [PATCH net 7/9] wireguard: allowedips: remove nodes in O(1) Jason A. Donenfeld
2021-06-04 15:17 ` [PATCH net 8/9] wireguard: allowedips: allocate nodes in kmem_cache Jason A. Donenfeld
2021-06-04 15:17 ` [PATCH net 9/9] wireguard: allowedips: free empty intermediate nodes when removing single node Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210604151738.220232-7-Jason@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.