diff options
author | Willy Tarreau <w@1wt.eu> | 2022-05-02 10:46:09 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-25 11:45:19 +0200 |
commit | 2ed413f140bbb527745e3b42550f44d07c9dfd2a (patch) | |
tree | 93ea1fe1392ff0c22176c544fc4fb5b90fba54f0 | |
parent | 576696ed0dee677ec868960c39d96ae3b8c95a3f (diff) | |
download | linux-stable-2ed413f140bbb527745e3b42550f44d07c9dfd2a.tar.gz linux-stable-2ed413f140bbb527745e3b42550f44d07c9dfd2a.tar.bz2 linux-stable-2ed413f140bbb527745e3b42550f44d07c9dfd2a.zip |
tcp: use different parts of the port_offset for index and offset
commit 9e9b70ae923baf2b5e8a0ea4fd0c8451801ac526 upstream.
Amit Klein suggests that we use different parts of port_offset for the
table's index and the port offset so that there is no direct relation
between them.
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Moshe Kol <moshe.kol@mail.huji.ac.il>
Cc: Yossi Gilad <yossi.gilad@mail.huji.ac.il>
Cc: Amit Klein <aksecurity@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/ipv4/inet_hashtables.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 025e87ed97a2..9ce1b7e97365 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -589,7 +589,7 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, net_get_random_once(table_perturb, sizeof(table_perturb)); index = hash_32(port_offset, INET_TABLE_PERTURB_SHIFT); - offset = READ_ONCE(table_perturb[index]) + port_offset; + offset = READ_ONCE(table_perturb[index]) + (port_offset >> 32); offset %= remaining; /* In first pass we try ports of @low parity. |