mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
74757d4901
commit
9327f7053e
8 changed files with 35 additions and 17 deletions
|
|
@ -408,7 +408,7 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
|
|||
|
||||
dccp_sync_mss(newsk, dst_mtu(dst));
|
||||
|
||||
__inet_hash_nolisten(newsk);
|
||||
__inet_hash_nolisten(newsk, NULL);
|
||||
__inet_inherit_port(sk, newsk);
|
||||
|
||||
return newsk;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ static void dccp_v6_hash(struct sock *sk)
|
|||
return;
|
||||
}
|
||||
local_bh_disable();
|
||||
__inet6_hash(sk);
|
||||
__inet6_hash(sk, NULL);
|
||||
local_bh_enable();
|
||||
}
|
||||
}
|
||||
|
|
@ -644,7 +644,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
|
|||
newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6;
|
||||
newinet->inet_rcv_saddr = LOOPBACK4_IPV6;
|
||||
|
||||
__inet6_hash(newsk);
|
||||
__inet6_hash(newsk, NULL);
|
||||
__inet_inherit_port(sk, newsk);
|
||||
|
||||
return newsk;
|
||||
|
|
|
|||
Loading…
Reference in a new issue