tcp: Iterate tb->bhash2 in inet_csk_bind_conflict().
authorKuniyuki Iwashima <kuniyu@amazon.com>
Tue, 19 Dec 2023 00:18:29 +0000 (09:18 +0900)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 Dec 2023 22:15:35 +0000 (22:15 +0000)
commitb82ba728ccfecb4cee518199597598ef385b47d5
tree589bd1b46af12c706ad8a00aa560f952a1c34e95
parent58655bc0ad7ccdd5b53319bcc091cb81b6aee7c3
tcp: Iterate tb->bhash2 in inet_csk_bind_conflict().

Sockets in bhash are also linked to bhash2, but TIME_WAIT sockets
are linked separately in tb2->deathrow.

Let's replace tb->owners iteration in inet_csk_bind_conflict() with
two iterations over tb2->owners and tb2->deathrow.

This can be done safely under bhash's lock because socket insertion/
deletion in bhash2 happens with bhash's lock held.

Note that twsk_for_each_bound_bhash() will be removed later.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/inet_connection_sock.c