aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-11-03 22:04:05 -0800
committerMark Brown <broonie@linaro.org>2013-11-03 22:04:05 -0800
commitca89bc248e2fac44d6374a48b8d38b068c7a1bdf (patch)
tree0c10af2a5f22a1ad0283023d403022ce6b84ebc4 /net/unix/af_unix.c
parentMerge remote-tracking branch 'asoc/topic/wm8962' into asoc-next (diff)
parentASoC: ak4642: prevent un-necessary changes to SG_SL1 (diff)
downloadwireguard-linux-ca89bc248e2fac44d6374a48b8d38b068c7a1bdf.tar.xz
wireguard-linux-ca89bc248e2fac44d6374a48b8d38b068c7a1bdf.zip
Merge remote-tracking branch 'asoc/fix/ak4642' into asoc-linus
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c10
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;