tcp: fix req->saved_syn race
For the reasons explained in commitce1050089c("tcp/dccp: fix ireq->pktopts race"), we need to make sure we do not access req->saved_syn unless we own the request sock. This fixes races for listeners using TCP_SAVE_SYN option. Fixes:e994b2f0fb("tcp: do not lock listener to process SYN packets") Fixes:079096f103("tcp/dccp: install syn_recv requests into ehash table") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Ying Cai <ycai@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
428ad1bc6d
commit
805c4bc057
@@ -397,6 +397,13 @@ static inline void fastopen_queue_tune(struct sock *sk, int backlog)
|
||||
queue->fastopenq.max_qlen = min_t(unsigned int, backlog, somaxconn);
|
||||
}
|
||||
|
||||
static inline void tcp_move_syn(struct tcp_sock *tp,
|
||||
struct request_sock *req)
|
||||
{
|
||||
tp->saved_syn = req->saved_syn;
|
||||
req->saved_syn = NULL;
|
||||
}
|
||||
|
||||
static inline void tcp_saved_syn_free(struct tcp_sock *tp)
|
||||
{
|
||||
kfree(tp->saved_syn);
|
||||
|
||||
Reference in New Issue
Block a user