/* The peer socket should always be NULL (or else). When we call this function we are destroying the object and from then on nobody should refer to it.  */
int inet_release(struct socket *sock)
/* The peer socket should always be NULL (or else). When we call this function we are destroying the object and from then on nobody should refer to it.  */
int inet_release(struct socket *sock)
{
	struct sock *sk = sock->sk;
	if (sk) {
		long timeout;
		ip_mc_drop_socket(sk);
		timeout = 0;
		if (sock_flag(sk, SOCK_LINGER) &&
		    !(current->flags & PF_EXITING))
			timeout = sk->sk_lingertime;
		sock->sk = NULL;
		sk->sk_prot->close(sk, timeout);
	}
	return 0;
}