Message ID | 20220427065233.2075-3-w@1wt.eu (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | insufficient TCP source port randomness | expand |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 09cbad0488ca..747f272da25b 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -777,7 +777,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) % remaining; + offset = (READ_ONCE(table_perturb[index]) + (port_offset >> 32)) % remaining; /* In first pass we try ports of @low parity. * inet_csk_get_port() does the opposite choice. */