diff options
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 2026542d6836..d0670f00d524 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -710,6 +710,22 @@ void inet_csk_destroy_sock(struct sock *sk) | |||
710 | } | 710 | } |
711 | EXPORT_SYMBOL(inet_csk_destroy_sock); | 711 | EXPORT_SYMBOL(inet_csk_destroy_sock); |
712 | 712 | ||
713 | /* This function allows to force a closure of a socket after the call to | ||
714 | * tcp/dccp_create_openreq_child(). | ||
715 | */ | ||
716 | void inet_csk_prepare_forced_close(struct sock *sk) | ||
717 | { | ||
718 | /* sk_clone_lock locked the socket and set refcnt to 2 */ | ||
719 | bh_unlock_sock(sk); | ||
720 | sock_put(sk); | ||
721 | |||
722 | /* The below has to be done to allow calling inet_csk_destroy_sock */ | ||
723 | sock_set_flag(sk, SOCK_DEAD); | ||
724 | percpu_counter_inc(sk->sk_prot->orphan_count); | ||
725 | inet_sk(sk)->inet_num = 0; | ||
726 | } | ||
727 | EXPORT_SYMBOL(inet_csk_prepare_forced_close); | ||
728 | |||
713 | int inet_csk_listen_start(struct sock *sk, const int nr_table_entries) | 729 | int inet_csk_listen_start(struct sock *sk, const int nr_table_entries) |
714 | { | 730 | { |
715 | struct inet_sock *inet = inet_sk(sk); | 731 | struct inet_sock *inet = inet_sk(sk); |