You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
tcp: Fix a connect() race with timewait sockets
When we find a timewait connection in __inet_hash_connect() and reuse it for a new connection request, we have a race window, releasing bind list lock and reacquiring it in __inet_twsk_kill() to remove timewait socket from list. Another thread might find the timewait socket we already chose, leading to list corruption and crashes. Fix is to remove timewait socket from bind list before releasing the bind lock. Note: This problem happens if sysctl_tcp_tw_reuse is set. 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
9327f7053e
commit
3cdaedae63
@@ -201,6 +201,9 @@ extern void inet_twsk_put(struct inet_timewait_sock *tw);
|
||||
|
||||
extern int inet_twsk_unhash(struct inet_timewait_sock *tw);
|
||||
|
||||
extern int inet_twsk_bind_unhash(struct inet_timewait_sock *tw,
|
||||
struct inet_hashinfo *hashinfo);
|
||||
|
||||
extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
|
||||
const int state);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user