diff options
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 11 | 
1 files changed, 5 insertions, 6 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 51be64f163e..971282b6f6a 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -382,7 +382,7 @@ static void unix_sock_destructor(struct sock *sk)  #endif  } -static int unix_release_sock(struct sock *sk, int embrion) +static void unix_release_sock(struct sock *sk, int embrion)  {  	struct unix_sock *u = unix_sk(sk);  	struct path path; @@ -451,8 +451,6 @@ static int unix_release_sock(struct sock *sk, int embrion)  	if (unix_tot_inflight)  		unix_gc();		/* Garbage collect fds */ - -	return 0;  }  static void init_peercred(struct sock *sk) @@ -699,9 +697,10 @@ static int unix_release(struct socket *sock)  	if (!sk)  		return 0; +	unix_release_sock(sk, 0);  	sock->sk = NULL; -	return unix_release_sock(sk, 0); +	return 0;  }  static int unix_autobind(struct socket *sock) @@ -1413,8 +1412,8 @@ static void maybe_add_creds(struct sk_buff *skb, const struct socket *sock,  	if (UNIXCB(skb).cred)  		return;  	if (test_bit(SOCK_PASSCRED, &sock->flags) || -	    !other->sk_socket || -	    test_bit(SOCK_PASSCRED, &other->sk_socket->flags)) { +	    (other->sk_socket && +	    test_bit(SOCK_PASSCRED, &other->sk_socket->flags))) {  		UNIXCB(skb).pid  = get_pid(task_tgid(current));  		UNIXCB(skb).cred = get_current_cred();  	}  |