]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
wireguard: allowedips: expand maximum node depth
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 7 Aug 2023 13:21:27 +0000 (15:21 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 30 Oct 2023 11:00:00 +0000 (12:00 +0100)
commit33a18db618c4fc550956a9a993268a0e2bfd52f0
tree88705ac116efee90cbcb93c12eb0fede860693cc
parent60eab89dd3fbcc084b67a97549ac7e8577cb64a9
wireguard: allowedips: expand maximum node depth

BugLink: https://bugs.launchpad.net/bugs/2038969
commit 46622219aae2b67813fe31a7b8cb7da5baff5c8a upstream.

In the allowedips self-test, nodes are inserted into the tree, but it
generated an even amount of nodes, but for checking maximum node depth,
there is of course the root node, which makes the total number
necessarily odd. With two few nodes added, it never triggered the
maximum depth check like it should have. So, add 129 nodes instead of
128 nodes, and do so with a more straightforward scheme, starting with
all the bits set, and shifting over one each time. Then increase the
maximum depth to 129, and choose a better name for that variable to
make it clear that it represents depth as opposed to bits.

Cc: stable@vger.kernel.org
Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Link: https://lore.kernel.org/r/20230807132146.2191597-2-Jason@zx2c4.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/wireguard/allowedips.c
drivers/net/wireguard/selftest/allowedips.c