OSDN Git Service

Merge 4.4.177 into android-4.4
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / net / ipv4 / tcp_input.c
index 6497f87..5202a04 100644 (file)
@@ -6410,7 +6410,13 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
                af_ops->send_synack(fastopen_sk, dst, &fl, req,
                                    &foc, false);
                /* Add the child socket directly into the accept queue */
-               inet_csk_reqsk_queue_add(sk, req, fastopen_sk);
+               if (!inet_csk_reqsk_queue_add(sk, req, fastopen_sk)) {
+                       reqsk_fastopen_remove(fastopen_sk, req, false);
+                       bh_unlock_sock(fastopen_sk);
+                       sock_put(fastopen_sk);
+                       reqsk_put(req);
+                       goto drop;
+               }
                sk->sk_data_ready(sk);
                bh_unlock_sock(fastopen_sk);
                sock_put(fastopen_sk);