Skip to content

Commit 46cfe8e

Browse files
zx2c4davem330
authored andcommitted
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: e7096c1 ("net: WireGuard secure network tunnel") Cc: [email protected] Signed-off-by: Jason A. Donenfeld <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a4e9f8e commit 46cfe8e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/wireguard/selftest/allowedips.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ static __init bool randomized_test(void)
296296
goto free;
297297
}
298298
kref_init(&peers[i]->refcount);
299+
INIT_LIST_HEAD(&peers[i]->allowedips_list);
299300
}
300301

301302
mutex_lock(&mutex);
@@ -333,7 +334,7 @@ static __init bool randomized_test(void)
333334
if (wg_allowedips_insert_v4(&t,
334335
(struct in_addr *)mutated,
335336
cidr, peer, &mutex) < 0) {
336-
pr_err("allowedips random malloc: FAIL\n");
337+
pr_err("allowedips random self-test malloc: FAIL\n");
337338
goto free_locked;
338339
}
339340
if (horrible_allowedips_insert_v4(&h,

0 commit comments

Comments
 (0)