aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-04-21 17:03:25 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2021-05-19 18:05:55 +0200
commit89f42be8da8eb1cab30ef2ebf8ebcaf3811eede6 (patch)
treeb5603bf1a476920bc73e91ffc78c837c5839fd3b
parentMerge branch 'hns3-fixes' (diff)
downloadwireguard-linux-89f42be8da8eb1cab30ef2ebf8ebcaf3811eede6.tar.xz
wireguard-linux-89f42be8da8eb1cab30ef2ebf8ebcaf3811eede6.zip
wireguard: allowedips: initialize list head in selftest
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") Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--drivers/net/wireguard/selftest/allowedips.c3
1 files changed, 2 insertions, 1 deletions
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,