diff options
author | Kuniyuki Iwashima <[email protected]> | 2022-12-26 22:27:52 +0900 |
---|---|---|
committer | David S. Miller <[email protected]> | 2022-12-30 07:25:52 +0000 |
commit | 936a192f974018b4f6040f6f77b1cc1e75bd8666 (patch) | |
tree | a69f32b36b71ddadb25fdffdba76d8ad380fc7f2 /lib/mpi/mpi-inline.h | |
parent | 40cab44b9089a41f71bbd0eff753eb91d5dafd68 (diff) |
tcp: Add TIME_WAIT sockets in bhash2.
Jiri Slaby reported regression of bind() with a simple repro. [0]
The repro creates a TIME_WAIT socket and tries to bind() a new socket
with the same local address and port. Before commit 28044fc1d495 ("net:
Add a bhash2 table hashed by port and address"), the bind() failed with
-EADDRINUSE, but now it succeeds.
The cited commit should have put TIME_WAIT sockets into bhash2; otherwise,
inet_bhash2_conflict() misses TIME_WAIT sockets when validating bind()
requests if the address is not a wildcard one.
The straight option is to move sk_bind2_node from struct sock to struct
sock_common to add twsk to bhash2 as implemented as RFC. [1] However, the
binary layout change in the struct sock could affect performances moving
hot fields on different cachelines.
To avoid that, we add another TIME_WAIT list in inet_bind2_bucket and check
it while validating bind().
[0]: https://lore.kernel.org/netdev/[email protected]/
[1]: https://lore.kernel.org/netdev/[email protected]/
Fixes: 28044fc1d495 ("net: Add a bhash2 table hashed by port and address")
Reported-by: Jiri Slaby <[email protected]>
Suggested-by: Paolo Abeni <[email protected]>
Signed-off-by: Kuniyuki Iwashima <[email protected]>
Acked-by: Joanne Koong <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-inline.h')
0 files changed, 0 insertions, 0 deletions