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) | |||
1246 | return 0; | 1246 | return 0; |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | static void unix_sock_inherit_flags(const struct socket *old, | ||
1250 | struct socket *new) | ||
1251 | { | ||
1252 | if (test_bit(SOCK_PASSCRED, &old->flags)) | ||
1253 | set_bit(SOCK_PASSCRED, &new->flags); | ||
1254 | if (test_bit(SOCK_PASSSEC, &old->flags)) | ||
1255 | set_bit(SOCK_PASSSEC, &new->flags); | ||
1256 | } | ||
1257 | |||
1249 | static int unix_accept(struct socket *sock, struct socket *newsock, int flags) | 1258 | static int unix_accept(struct socket *sock, struct socket *newsock, int flags) |
1250 | { | 1259 | { |
1251 | struct sock *sk = sock->sk; | 1260 | struct sock *sk = sock->sk; |
@@ -1280,6 +1289,7 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags) | |||
1280 | /* attach accepted sock to socket */ | 1289 | /* attach accepted sock to socket */ |
1281 | unix_state_lock(tsk); | 1290 | unix_state_lock(tsk); |
1282 | newsock->state = SS_CONNECTED; | 1291 | newsock->state = SS_CONNECTED; |
1292 | unix_sock_inherit_flags(sock, newsock); | ||
1283 | sock_graft(tsk, newsock); | 1293 | sock_graft(tsk, newsock); |
1284 | unix_state_unlock(tsk); | 1294 | unix_state_unlock(tsk); |
1285 | return 0; | 1295 | return 0; |