aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/syncookies.c7
-rw-r--r--net/ipv4/tcp_input.c8
2 files changed, 13 insertions, 2 deletions
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 606f868d9f3f..e531344611a0 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -216,7 +216,12 @@ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
216 refcount_set(&req->rsk_refcnt, 1); 216 refcount_set(&req->rsk_refcnt, 1);
217 tcp_sk(child)->tsoffset = tsoff; 217 tcp_sk(child)->tsoffset = tsoff;
218 sock_rps_save_rxhash(child, skb); 218 sock_rps_save_rxhash(child, skb);
219 inet_csk_reqsk_queue_add(sk, req, child); 219 if (!inet_csk_reqsk_queue_add(sk, req, child)) {
220 bh_unlock_sock(child);
221 sock_put(child);
222 child = NULL;
223 reqsk_put(req);
224 }
220 } else { 225 } else {
221 reqsk_free(req); 226 reqsk_free(req);
222 } 227 }
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 4eb0c8ca3c60..5def3c48870e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6498,7 +6498,13 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
6498 af_ops->send_synack(fastopen_sk, dst, &fl, req, 6498 af_ops->send_synack(fastopen_sk, dst, &fl, req,
6499 &foc, TCP_SYNACK_FASTOPEN); 6499 &foc, TCP_SYNACK_FASTOPEN);
6500 /* Add the child socket directly into the accept queue */ 6500 /* Add the child socket directly into the accept queue */
6501 inet_csk_reqsk_queue_add(sk, req, fastopen_sk); 6501 if (!inet_csk_reqsk_queue_add(sk, req, fastopen_sk)) {
6502 reqsk_fastopen_remove(fastopen_sk, req, false);
6503 bh_unlock_sock(fastopen_sk);
6504 sock_put(fastopen_sk);
6505 reqsk_put(req);
6506 goto drop;
6507 }
6502 sk->sk_data_ready(sk); 6508 sk->sk_data_ready(sk);
6503 bh_unlock_sock(fastopen_sk); 6509 bh_unlock_sock(fastopen_sk);
6504 sock_put(fastopen_sk); 6510 sock_put(fastopen_sk);