mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 23:52:40 +00: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 <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:
parent
74757d4901
commit
9327f7053e
8 changed files with 35 additions and 17 deletions
|
@ -251,7 +251,7 @@ extern void inet_put_port(struct sock *sk);
|
|||
|
||||
void inet_hashinfo_init(struct inet_hashinfo *h);
|
||||
|
||||
extern void __inet_hash_nolisten(struct sock *sk);
|
||||
extern int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw);
|
||||
extern void inet_hash(struct sock *sk);
|
||||
extern void inet_unhash(struct sock *sk);
|
||||
|
||||
|
@ -391,10 +391,12 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
|
|||
}
|
||||
|
||||
extern int __inet_hash_connect(struct inet_timewait_death_row *death_row,
|
||||
struct sock *sk, u32 port_offset,
|
||||
struct sock *sk,
|
||||
u32 port_offset,
|
||||
int (*check_established)(struct inet_timewait_death_row *,
|
||||
struct sock *, __u16, struct inet_timewait_sock **),
|
||||
void (*hash)(struct sock *sk));
|
||||
int (*hash)(struct sock *sk, struct inet_timewait_sock *twp));
|
||||
|
||||
extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
|
||||
struct sock *sk);
|
||||
#endif /* _INET_HASHTABLES_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue