X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=net%2Fipv4%2Finet_connection_sock.c;h=d0670f00d5243f95bec4536f60edf32fa2ded850;hb=03a9477e23556df0d4f5f7b931f9be893f96065f;hp=2026542d683647b1199c02a8d634d3e0d11f7ff4;hpb=ae664dba2724e59ddd66291b895f7370e28b9a7a;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 2026542..d0670f0 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) } EXPORT_SYMBOL(inet_csk_destroy_sock); +/* This function allows to force a closure of a socket after the call to + * tcp/dccp_create_openreq_child(). + */ +void inet_csk_prepare_forced_close(struct sock *sk) +{ + /* sk_clone_lock locked the socket and set refcnt to 2 */ + bh_unlock_sock(sk); + sock_put(sk); + + /* The below has to be done to allow calling inet_csk_destroy_sock */ + sock_set_flag(sk, SOCK_DEAD); + percpu_counter_inc(sk->sk_prot->orphan_count); + inet_sk(sk)->inet_num = 0; +} +EXPORT_SYMBOL(inet_csk_prepare_forced_close); + int inet_csk_listen_start(struct sock *sk, const int nr_table_entries) { struct inet_sock *inet = inet_sk(sk);