diff options
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 10 | 
1 files changed, 10 insertions, 0 deletions
| diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 86de99ad2976..c1f403bed683 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1246,6 +1246,15 @@ static int unix_socketpair(struct socket *socka, struct socket *sockb)  	return 0;  } +static void unix_sock_inherit_flags(const struct socket *old, +				    struct socket *new) +{ +	if (test_bit(SOCK_PASSCRED, &old->flags)) +		set_bit(SOCK_PASSCRED, &new->flags); +	if (test_bit(SOCK_PASSSEC, &old->flags)) +		set_bit(SOCK_PASSSEC, &new->flags); +} +  static int unix_accept(struct socket *sock, struct socket *newsock, int flags)  {  	struct sock *sk = sock->sk; @@ -1280,6 +1289,7 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags)  	/* attach accepted sock to socket */  	unix_state_lock(tsk);  	newsock->state = SS_CONNECTED; +	unix_sock_inherit_flags(sock, newsock);  	sock_graft(tsk, newsock);  	unix_state_unlock(tsk);  	return 0; | 
