wireguard: allowedips: initialize list head in selftest
commit46cfe8eee2
upstream. 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:e7096c131e
("net: WireGuard secure network tunnel") Cc: stable@vger.kernel.org Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
842c21d6a0
commit
42a667715b
@ -296,6 +296,7 @@ static __init bool randomized_test(void)
|
|||||||
goto free;
|
goto free;
|
||||||
}
|
}
|
||||||
kref_init(&peers[i]->refcount);
|
kref_init(&peers[i]->refcount);
|
||||||
|
INIT_LIST_HEAD(&peers[i]->allowedips_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_lock(&mutex);
|
mutex_lock(&mutex);
|
||||||
@ -333,7 +334,7 @@ static __init bool randomized_test(void)
|
|||||||
if (wg_allowedips_insert_v4(&t,
|
if (wg_allowedips_insert_v4(&t,
|
||||||
(struct in_addr *)mutated,
|
(struct in_addr *)mutated,
|
||||||
cidr, peer, &mutex) < 0) {
|
cidr, peer, &mutex) < 0) {
|
||||||
pr_err("allowedips random malloc: FAIL\n");
|
pr_err("allowedips random self-test malloc: FAIL\n");
|
||||||
goto free_locked;
|
goto free_locked;
|
||||||
}
|
}
|
||||||
if (horrible_allowedips_insert_v4(&h,
|
if (horrible_allowedips_insert_v4(&h,
|
||||||
|
Reference in New Issue
Block a user