Skip to content
Snippets Groups Projects
Commit c191a836 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

tcp: disallow bind() to reuse addr/port


inet_csk_bind_conflict() logic currently disallows a bind() if
it finds a friend socket (a socket bound on same address/port)
satisfying a set of conditions :

1) Current (to be bound) socket doesnt have sk_reuse set
OR
2) other socket doesnt have sk_reuse set
OR
3) other socket is in LISTEN state

We should add the CLOSE state in the 3) condition, in order to avoid two
REUSEADDR sockets in CLOSE state with same local address/port, since
this can deny further operations.

Note : a prior patch tried to address the problem in a different (and
buggy) way. (commit fda48a0d tcp: bind() fix when many ports
are bound).

Reported-by: default avatarGaspar Chilingarov <gasparch@gmail.com>
Reported-by: default avatarDaniel Baluta <daniel.baluta@gmail.com>
Tested-by: default avatarDaniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 42b82dc1
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment