tcp: Fix a connect() race with timewait sockets
First patch changes __inet_hash_nolisten() and __inet6_hash() to get a timewait parameter to be able to unhash it from ehash at same time the new socket is inserted in hash. This makes sure timewait socket wont be found by a concurrent writer in __inet_check_established() Reported-by: kapil dakhane <kdakhane@gmail.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
74757d4901
commit
9327f7053e
@ -53,7 +53,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
|
||||
return inet6_ehashfn(net, laddr, lport, faddr, fport);
|
||||
}
|
||||
|
||||
extern void __inet6_hash(struct sock *sk);
|
||||
extern int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp);
|
||||
|
||||
/*
|
||||
* Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
|
||||
|
Reference in New Issue
Block a user