aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_connection_sock.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-03-16 00:12:16 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-16 15:55:29 -0400
commit13854e5a60461daee08ce99842b7f4d37553d911 (patch)
treef7bf7650ead7d8af1e93d98114da5cd1bf658956 /net/ipv4/inet_connection_sock.c
parent2c13270b441054a9596bcd99c0f446603c9ad131 (diff)
inet: add proper refcounting to request sock
reqsk_put() is the generic function that should be used to release a refcount (and automatically call reqsk_free()) reqsk_free() might be called if refcount is known to be 0 or undefined. refcnt is set to one in inet_csk_reqsk_queue_add() As request socks are not yet in global ehash table, I added temporary debugging checks in reqsk_put() and reqsk_free() Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r--net/ipv4/inet_connection_sock.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 34581f928afa..3390ba6f96b2 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -340,7 +340,7 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err)
340out: 340out:
341 release_sock(sk); 341 release_sock(sk);
342 if (req) 342 if (req)
343 __reqsk_free(req); 343 reqsk_put(req);
344 return newsk; 344 return newsk;
345out_err: 345out_err:
346 newsk = NULL; 346 newsk = NULL;
@@ -635,7 +635,7 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
635 /* Drop this request */ 635 /* Drop this request */
636 inet_csk_reqsk_queue_unlink(parent, req, reqp); 636 inet_csk_reqsk_queue_unlink(parent, req, reqp);
637 reqsk_queue_removed(queue, req); 637 reqsk_queue_removed(queue, req);
638 reqsk_free(req); 638 reqsk_put(req);
639 continue; 639 continue;
640 } 640 }
641 reqp = &req->dl_next; 641 reqp = &req->dl_next;
@@ -837,7 +837,7 @@ void inet_csk_listen_stop(struct sock *sk)
837 sock_put(child); 837 sock_put(child);
838 838
839 sk_acceptq_removed(sk); 839 sk_acceptq_removed(sk);
840 __reqsk_free(req); 840 reqsk_put(req);
841 } 841 }
842 if (queue->fastopenq != NULL) { 842 if (queue->fastopenq != NULL) {
843 /* Free all the reqs queued in rskq_rst_head. */ 843 /* Free all the reqs queued in rskq_rst_head. */
@@ -847,7 +847,7 @@ void inet_csk_listen_stop(struct sock *sk)
847 spin_unlock_bh(&queue->fastopenq->lock); 847 spin_unlock_bh(&queue->fastopenq->lock);
848 while ((req = acc_req) != NULL) { 848 while ((req = acc_req) != NULL) {
849 acc_req = req->dl_next; 849 acc_req = req->dl_next;
850 __reqsk_free(req); 850 reqsk_put(req);
851 } 851 }
852 } 852 }
853 WARN_ON(sk->sk_ack_backlog); 853 WARN_ON(sk->sk_ack_backlog);