inet_connection_sock.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. /*
  2. * INET An implementation of the TCP/IP protocol suite for the LINUX
  3. * operating system. INET is implemented using the BSD Socket
  4. * interface as the means of communication with the user level.
  5. *
  6. * Support for INET connection oriented protocols.
  7. *
  8. * Authors: See the TCP sources
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version
  13. * 2 of the License, or(at your option) any later version.
  14. */
  15. #include <linux/config.h>
  16. #include <linux/module.h>
  17. #include <linux/jhash.h>
  18. #include <net/inet_connection_sock.h>
  19. #include <net/inet_hashtables.h>
  20. #include <net/inet_timewait_sock.h>
  21. #include <net/ip.h>
  22. #include <net/route.h>
  23. #include <net/tcp_states.h>
  24. #include <net/xfrm.h>
  25. #ifdef INET_CSK_DEBUG
  26. const char inet_csk_timer_bug_msg[] = "inet_csk BUG: unknown timer value\n";
  27. EXPORT_SYMBOL(inet_csk_timer_bug_msg);
  28. #endif
  29. /*
  30. * This array holds the first and last local port number.
  31. * For high-usage systems, use sysctl to change this to
  32. * 32768-61000
  33. */
  34. int sysctl_local_port_range[2] = { 1024, 4999 };
  35. static inline int inet_csk_bind_conflict(struct sock *sk, struct inet_bind_bucket *tb)
  36. {
  37. const u32 sk_rcv_saddr = inet_rcv_saddr(sk);
  38. struct sock *sk2;
  39. struct hlist_node *node;
  40. int reuse = sk->sk_reuse;
  41. sk_for_each_bound(sk2, node, &tb->owners) {
  42. if (sk != sk2 &&
  43. !inet_v6_ipv6only(sk2) &&
  44. (!sk->sk_bound_dev_if ||
  45. !sk2->sk_bound_dev_if ||
  46. sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
  47. if (!reuse || !sk2->sk_reuse ||
  48. sk2->sk_state == TCP_LISTEN) {
  49. const u32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
  50. if (!sk2_rcv_saddr || !sk_rcv_saddr ||
  51. sk2_rcv_saddr == sk_rcv_saddr)
  52. break;
  53. }
  54. }
  55. }
  56. return node != NULL;
  57. }
  58. /* Obtain a reference to a local port for the given sock,
  59. * if snum is zero it means select any available local port.
  60. */
  61. int inet_csk_get_port(struct inet_hashinfo *hashinfo,
  62. struct sock *sk, unsigned short snum)
  63. {
  64. struct inet_bind_hashbucket *head;
  65. struct hlist_node *node;
  66. struct inet_bind_bucket *tb;
  67. int ret;
  68. local_bh_disable();
  69. if (!snum) {
  70. int low = sysctl_local_port_range[0];
  71. int high = sysctl_local_port_range[1];
  72. int remaining = (high - low) + 1;
  73. int rover = net_random() % (high - low) + low;
  74. do {
  75. head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)];
  76. spin_lock(&head->lock);
  77. inet_bind_bucket_for_each(tb, node, &head->chain)
  78. if (tb->port == rover)
  79. goto next;
  80. break;
  81. next:
  82. spin_unlock(&head->lock);
  83. if (++rover > high)
  84. rover = low;
  85. } while (--remaining > 0);
  86. /* Exhausted local port range during search? It is not
  87. * possible for us to be holding one of the bind hash
  88. * locks if this test triggers, because if 'remaining'
  89. * drops to zero, we broke out of the do/while loop at
  90. * the top level, not from the 'break;' statement.
  91. */
  92. ret = 1;
  93. if (remaining <= 0)
  94. goto fail;
  95. /* OK, here is the one we will use. HEAD is
  96. * non-NULL and we hold it's mutex.
  97. */
  98. snum = rover;
  99. } else {
  100. head = &hashinfo->bhash[inet_bhashfn(snum, hashinfo->bhash_size)];
  101. spin_lock(&head->lock);
  102. inet_bind_bucket_for_each(tb, node, &head->chain)
  103. if (tb->port == snum)
  104. goto tb_found;
  105. }
  106. tb = NULL;
  107. goto tb_not_found;
  108. tb_found:
  109. if (!hlist_empty(&tb->owners)) {
  110. if (sk->sk_reuse > 1)
  111. goto success;
  112. if (tb->fastreuse > 0 &&
  113. sk->sk_reuse && sk->sk_state != TCP_LISTEN) {
  114. goto success;
  115. } else {
  116. ret = 1;
  117. if (inet_csk_bind_conflict(sk, tb))
  118. goto fail_unlock;
  119. }
  120. }
  121. tb_not_found:
  122. ret = 1;
  123. if (!tb && (tb = inet_bind_bucket_create(hashinfo->bind_bucket_cachep, head, snum)) == NULL)
  124. goto fail_unlock;
  125. if (hlist_empty(&tb->owners)) {
  126. if (sk->sk_reuse && sk->sk_state != TCP_LISTEN)
  127. tb->fastreuse = 1;
  128. else
  129. tb->fastreuse = 0;
  130. } else if (tb->fastreuse &&
  131. (!sk->sk_reuse || sk->sk_state == TCP_LISTEN))
  132. tb->fastreuse = 0;
  133. success:
  134. if (!inet_csk(sk)->icsk_bind_hash)
  135. inet_bind_hash(sk, tb, snum);
  136. BUG_TRAP(inet_csk(sk)->icsk_bind_hash == tb);
  137. ret = 0;
  138. fail_unlock:
  139. spin_unlock(&head->lock);
  140. fail:
  141. local_bh_enable();
  142. return ret;
  143. }
  144. EXPORT_SYMBOL_GPL(inet_csk_get_port);
  145. /*
  146. * Wait for an incoming connection, avoid race conditions. This must be called
  147. * with the socket locked.
  148. */
  149. static int inet_csk_wait_for_connect(struct sock *sk, long timeo)
  150. {
  151. struct inet_connection_sock *icsk = inet_csk(sk);
  152. DEFINE_WAIT(wait);
  153. int err;
  154. /*
  155. * True wake-one mechanism for incoming connections: only
  156. * one process gets woken up, not the 'whole herd'.
  157. * Since we do not 'race & poll' for established sockets
  158. * anymore, the common case will execute the loop only once.
  159. *
  160. * Subtle issue: "add_wait_queue_exclusive()" will be added
  161. * after any current non-exclusive waiters, and we know that
  162. * it will always _stay_ after any new non-exclusive waiters
  163. * because all non-exclusive waiters are added at the
  164. * beginning of the wait-queue. As such, it's ok to "drop"
  165. * our exclusiveness temporarily when we get woken up without
  166. * having to remove and re-insert us on the wait queue.
  167. */
  168. for (;;) {
  169. prepare_to_wait_exclusive(sk->sk_sleep, &wait,
  170. TASK_INTERRUPTIBLE);
  171. release_sock(sk);
  172. if (reqsk_queue_empty(&icsk->icsk_accept_queue))
  173. timeo = schedule_timeout(timeo);
  174. lock_sock(sk);
  175. err = 0;
  176. if (!reqsk_queue_empty(&icsk->icsk_accept_queue))
  177. break;
  178. err = -EINVAL;
  179. if (sk->sk_state != TCP_LISTEN)
  180. break;
  181. err = sock_intr_errno(timeo);
  182. if (signal_pending(current))
  183. break;
  184. err = -EAGAIN;
  185. if (!timeo)
  186. break;
  187. }
  188. finish_wait(sk->sk_sleep, &wait);
  189. return err;
  190. }
  191. /*
  192. * This will accept the next outstanding connection.
  193. */
  194. struct sock *inet_csk_accept(struct sock *sk, int flags, int *err)
  195. {
  196. struct inet_connection_sock *icsk = inet_csk(sk);
  197. struct sock *newsk;
  198. int error;
  199. lock_sock(sk);
  200. /* We need to make sure that this socket is listening,
  201. * and that it has something pending.
  202. */
  203. error = -EINVAL;
  204. if (sk->sk_state != TCP_LISTEN)
  205. goto out_err;
  206. /* Find already established connection */
  207. if (reqsk_queue_empty(&icsk->icsk_accept_queue)) {
  208. long timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK);
  209. /* If this is a non blocking socket don't sleep */
  210. error = -EAGAIN;
  211. if (!timeo)
  212. goto out_err;
  213. error = inet_csk_wait_for_connect(sk, timeo);
  214. if (error)
  215. goto out_err;
  216. }
  217. newsk = reqsk_queue_get_child(&icsk->icsk_accept_queue, sk);
  218. BUG_TRAP(newsk->sk_state != TCP_SYN_RECV);
  219. out:
  220. release_sock(sk);
  221. return newsk;
  222. out_err:
  223. newsk = NULL;
  224. *err = error;
  225. goto out;
  226. }
  227. EXPORT_SYMBOL(inet_csk_accept);
  228. /*
  229. * Using different timers for retransmit, delayed acks and probes
  230. * We may wish use just one timer maintaining a list of expire jiffies
  231. * to optimize.
  232. */
  233. void inet_csk_init_xmit_timers(struct sock *sk,
  234. void (*retransmit_handler)(unsigned long),
  235. void (*delack_handler)(unsigned long),
  236. void (*keepalive_handler)(unsigned long))
  237. {
  238. struct inet_connection_sock *icsk = inet_csk(sk);
  239. init_timer(&icsk->icsk_retransmit_timer);
  240. init_timer(&icsk->icsk_delack_timer);
  241. init_timer(&sk->sk_timer);
  242. icsk->icsk_retransmit_timer.function = retransmit_handler;
  243. icsk->icsk_delack_timer.function = delack_handler;
  244. sk->sk_timer.function = keepalive_handler;
  245. icsk->icsk_retransmit_timer.data =
  246. icsk->icsk_delack_timer.data =
  247. sk->sk_timer.data = (unsigned long)sk;
  248. icsk->icsk_pending = icsk->icsk_ack.pending = 0;
  249. }
  250. EXPORT_SYMBOL(inet_csk_init_xmit_timers);
  251. void inet_csk_clear_xmit_timers(struct sock *sk)
  252. {
  253. struct inet_connection_sock *icsk = inet_csk(sk);
  254. icsk->icsk_pending = icsk->icsk_ack.pending = icsk->icsk_ack.blocked = 0;
  255. sk_stop_timer(sk, &icsk->icsk_retransmit_timer);
  256. sk_stop_timer(sk, &icsk->icsk_delack_timer);
  257. sk_stop_timer(sk, &sk->sk_timer);
  258. }
  259. EXPORT_SYMBOL(inet_csk_clear_xmit_timers);
  260. void inet_csk_delete_keepalive_timer(struct sock *sk)
  261. {
  262. sk_stop_timer(sk, &sk->sk_timer);
  263. }
  264. EXPORT_SYMBOL(inet_csk_delete_keepalive_timer);
  265. void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long len)
  266. {
  267. sk_reset_timer(sk, &sk->sk_timer, jiffies + len);
  268. }
  269. EXPORT_SYMBOL(inet_csk_reset_keepalive_timer);
  270. struct dst_entry* inet_csk_route_req(struct sock *sk,
  271. const struct request_sock *req)
  272. {
  273. struct rtable *rt;
  274. const struct inet_request_sock *ireq = inet_rsk(req);
  275. struct ip_options *opt = inet_rsk(req)->opt;
  276. struct flowi fl = { .oif = sk->sk_bound_dev_if,
  277. .nl_u = { .ip4_u =
  278. { .daddr = ((opt && opt->srr) ?
  279. opt->faddr :
  280. ireq->rmt_addr),
  281. .saddr = ireq->loc_addr,
  282. .tos = RT_CONN_FLAGS(sk) } },
  283. .proto = sk->sk_protocol,
  284. .uli_u = { .ports =
  285. { .sport = inet_sk(sk)->sport,
  286. .dport = ireq->rmt_port } } };
  287. if (ip_route_output_flow(&rt, &fl, sk, 0)) {
  288. IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
  289. return NULL;
  290. }
  291. if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) {
  292. ip_rt_put(rt);
  293. IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
  294. return NULL;
  295. }
  296. return &rt->u.dst;
  297. }
  298. EXPORT_SYMBOL_GPL(inet_csk_route_req);
  299. static inline u32 inet_synq_hash(const u32 raddr, const u16 rport,
  300. const u32 rnd, const u16 synq_hsize)
  301. {
  302. return jhash_2words(raddr, (u32)rport, rnd) & (synq_hsize - 1);
  303. }
  304. #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
  305. #define AF_INET_FAMILY(fam) ((fam) == AF_INET)
  306. #else
  307. #define AF_INET_FAMILY(fam) 1
  308. #endif
  309. struct request_sock *inet_csk_search_req(const struct sock *sk,
  310. struct request_sock ***prevp,
  311. const __u16 rport, const __u32 raddr,
  312. const __u32 laddr)
  313. {
  314. const struct inet_connection_sock *icsk = inet_csk(sk);
  315. struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt;
  316. struct request_sock *req, **prev;
  317. for (prev = &lopt->syn_table[inet_synq_hash(raddr, rport, lopt->hash_rnd,
  318. lopt->nr_table_entries)];
  319. (req = *prev) != NULL;
  320. prev = &req->dl_next) {
  321. const struct inet_request_sock *ireq = inet_rsk(req);
  322. if (ireq->rmt_port == rport &&
  323. ireq->rmt_addr == raddr &&
  324. ireq->loc_addr == laddr &&
  325. AF_INET_FAMILY(req->rsk_ops->family)) {
  326. BUG_TRAP(!req->sk);
  327. *prevp = prev;
  328. break;
  329. }
  330. }
  331. return req;
  332. }
  333. EXPORT_SYMBOL_GPL(inet_csk_search_req);
  334. void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,
  335. const unsigned timeout)
  336. {
  337. struct inet_connection_sock *icsk = inet_csk(sk);
  338. struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt;
  339. const u32 h = inet_synq_hash(inet_rsk(req)->rmt_addr, inet_rsk(req)->rmt_port,
  340. lopt->hash_rnd, lopt->nr_table_entries);
  341. reqsk_queue_hash_req(&icsk->icsk_accept_queue, h, req, timeout);
  342. inet_csk_reqsk_queue_added(sk, timeout);
  343. }
  344. /* Only thing we need from tcp.h */
  345. extern int sysctl_tcp_synack_retries;
  346. EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_hash_add);
  347. void inet_csk_reqsk_queue_prune(struct sock *parent,
  348. const unsigned long interval,
  349. const unsigned long timeout,
  350. const unsigned long max_rto)
  351. {
  352. struct inet_connection_sock *icsk = inet_csk(parent);
  353. struct request_sock_queue *queue = &icsk->icsk_accept_queue;
  354. struct listen_sock *lopt = queue->listen_opt;
  355. int max_retries = icsk->icsk_syn_retries ? : sysctl_tcp_synack_retries;
  356. int thresh = max_retries;
  357. unsigned long now = jiffies;
  358. struct request_sock **reqp, *req;
  359. int i, budget;
  360. if (lopt == NULL || lopt->qlen == 0)
  361. return;
  362. /* Normally all the openreqs are young and become mature
  363. * (i.e. converted to established socket) for first timeout.
  364. * If synack was not acknowledged for 3 seconds, it means
  365. * one of the following things: synack was lost, ack was lost,
  366. * rtt is high or nobody planned to ack (i.e. synflood).
  367. * When server is a bit loaded, queue is populated with old
  368. * open requests, reducing effective size of queue.
  369. * When server is well loaded, queue size reduces to zero
  370. * after several minutes of work. It is not synflood,
  371. * it is normal operation. The solution is pruning
  372. * too old entries overriding normal timeout, when
  373. * situation becomes dangerous.
  374. *
  375. * Essentially, we reserve half of room for young
  376. * embrions; and abort old ones without pity, if old
  377. * ones are about to clog our table.
  378. */
  379. if (lopt->qlen>>(lopt->max_qlen_log-1)) {
  380. int young = (lopt->qlen_young<<1);
  381. while (thresh > 2) {
  382. if (lopt->qlen < young)
  383. break;
  384. thresh--;
  385. young <<= 1;
  386. }
  387. }
  388. if (queue->rskq_defer_accept)
  389. max_retries = queue->rskq_defer_accept;
  390. budget = 2 * (lopt->nr_table_entries / (timeout / interval));
  391. i = lopt->clock_hand;
  392. do {
  393. reqp=&lopt->syn_table[i];
  394. while ((req = *reqp) != NULL) {
  395. if (time_after_eq(now, req->expires)) {
  396. if ((req->retrans < thresh ||
  397. (inet_rsk(req)->acked && req->retrans < max_retries))
  398. && !req->rsk_ops->rtx_syn_ack(parent, req, NULL)) {
  399. unsigned long timeo;
  400. if (req->retrans++ == 0)
  401. lopt->qlen_young--;
  402. timeo = min((timeout << req->retrans), max_rto);
  403. req->expires = now + timeo;
  404. reqp = &req->dl_next;
  405. continue;
  406. }
  407. /* Drop this request */
  408. inet_csk_reqsk_queue_unlink(parent, req, reqp);
  409. reqsk_queue_removed(queue, req);
  410. reqsk_free(req);
  411. continue;
  412. }
  413. reqp = &req->dl_next;
  414. }
  415. i = (i + 1) & (lopt->nr_table_entries - 1);
  416. } while (--budget > 0);
  417. lopt->clock_hand = i;
  418. if (lopt->qlen)
  419. inet_csk_reset_keepalive_timer(parent, interval);
  420. }
  421. EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_prune);
  422. struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req,
  423. const gfp_t priority)
  424. {
  425. struct sock *newsk = sk_clone(sk, priority);
  426. if (newsk != NULL) {
  427. struct inet_connection_sock *newicsk = inet_csk(newsk);
  428. newsk->sk_state = TCP_SYN_RECV;
  429. newicsk->icsk_bind_hash = NULL;
  430. inet_sk(newsk)->dport = inet_rsk(req)->rmt_port;
  431. newsk->sk_write_space = sk_stream_write_space;
  432. newicsk->icsk_retransmits = 0;
  433. newicsk->icsk_backoff = 0;
  434. newicsk->icsk_probes_out = 0;
  435. /* Deinitialize accept_queue to trap illegal accesses. */
  436. memset(&newicsk->icsk_accept_queue, 0, sizeof(newicsk->icsk_accept_queue));
  437. }
  438. return newsk;
  439. }
  440. EXPORT_SYMBOL_GPL(inet_csk_clone);
  441. /*
  442. * At this point, there should be no process reference to this
  443. * socket, and thus no user references at all. Therefore we
  444. * can assume the socket waitqueue is inactive and nobody will
  445. * try to jump onto it.
  446. */
  447. void inet_csk_destroy_sock(struct sock *sk)
  448. {
  449. BUG_TRAP(sk->sk_state == TCP_CLOSE);
  450. BUG_TRAP(sock_flag(sk, SOCK_DEAD));
  451. /* It cannot be in hash table! */
  452. BUG_TRAP(sk_unhashed(sk));
  453. /* If it has not 0 inet_sk(sk)->num, it must be bound */
  454. BUG_TRAP(!inet_sk(sk)->num || inet_csk(sk)->icsk_bind_hash);
  455. sk->sk_prot->destroy(sk);
  456. sk_stream_kill_queues(sk);
  457. xfrm_sk_free_policy(sk);
  458. sk_refcnt_debug_release(sk);
  459. atomic_dec(sk->sk_prot->orphan_count);
  460. sock_put(sk);
  461. }
  462. EXPORT_SYMBOL(inet_csk_destroy_sock);
  463. int inet_csk_listen_start(struct sock *sk, const int nr_table_entries)
  464. {
  465. struct inet_sock *inet = inet_sk(sk);
  466. struct inet_connection_sock *icsk = inet_csk(sk);
  467. int rc = reqsk_queue_alloc(&icsk->icsk_accept_queue, nr_table_entries);
  468. if (rc != 0)
  469. return rc;
  470. sk->sk_max_ack_backlog = 0;
  471. sk->sk_ack_backlog = 0;
  472. inet_csk_delack_init(sk);
  473. /* There is race window here: we announce ourselves listening,
  474. * but this transition is still not validated by get_port().
  475. * It is OK, because this socket enters to hash table only
  476. * after validation is complete.
  477. */
  478. sk->sk_state = TCP_LISTEN;
  479. if (!sk->sk_prot->get_port(sk, inet->num)) {
  480. inet->sport = htons(inet->num);
  481. sk_dst_reset(sk);
  482. sk->sk_prot->hash(sk);
  483. return 0;
  484. }
  485. sk->sk_state = TCP_CLOSE;
  486. __reqsk_queue_destroy(&icsk->icsk_accept_queue);
  487. return -EADDRINUSE;
  488. }
  489. EXPORT_SYMBOL_GPL(inet_csk_listen_start);
  490. /*
  491. * This routine closes sockets which have been at least partially
  492. * opened, but not yet accepted.
  493. */
  494. void inet_csk_listen_stop(struct sock *sk)
  495. {
  496. struct inet_connection_sock *icsk = inet_csk(sk);
  497. struct request_sock *acc_req;
  498. struct request_sock *req;
  499. inet_csk_delete_keepalive_timer(sk);
  500. /* make all the listen_opt local to us */
  501. acc_req = reqsk_queue_yank_acceptq(&icsk->icsk_accept_queue);
  502. /* Following specs, it would be better either to send FIN
  503. * (and enter FIN-WAIT-1, it is normal close)
  504. * or to send active reset (abort).
  505. * Certainly, it is pretty dangerous while synflood, but it is
  506. * bad justification for our negligence 8)
  507. * To be honest, we are not able to make either
  508. * of the variants now. --ANK
  509. */
  510. reqsk_queue_destroy(&icsk->icsk_accept_queue);
  511. while ((req = acc_req) != NULL) {
  512. struct sock *child = req->sk;
  513. acc_req = req->dl_next;
  514. local_bh_disable();
  515. bh_lock_sock(child);
  516. BUG_TRAP(!sock_owned_by_user(child));
  517. sock_hold(child);
  518. sk->sk_prot->disconnect(child, O_NONBLOCK);
  519. sock_orphan(child);
  520. atomic_inc(sk->sk_prot->orphan_count);
  521. inet_csk_destroy_sock(child);
  522. bh_unlock_sock(child);
  523. local_bh_enable();
  524. sock_put(child);
  525. sk_acceptq_removed(sk);
  526. __reqsk_free(req);
  527. }
  528. BUG_TRAP(!sk->sk_ack_backlog);
  529. }
  530. EXPORT_SYMBOL_GPL(inet_csk_listen_stop);