summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authordingtianhong <dingtianhong@huawei.com>2013-03-25 17:02:04 +0000
committerDavid S. Miller <davem@davemloft.net>2013-03-26 12:33:55 -0400
commit14134f6584212d585b310ce95428014b653dfaf6 (patch)
treedfaa64172441eecd90557d1f1bedba1695fa4cd6 /net
parent465c0a165938992455357982d7f15ac105528b4a (diff)
downloadop-kernel-dev-14134f6584212d585b310ce95428014b653dfaf6.zip
op-kernel-dev-14134f6584212d585b310ce95428014b653dfaf6.tar.gz
af_unix: dont send SCM_CREDENTIAL when dest socket is NULL
SCM_SCREDENTIALS should apply to write() syscalls only either source or destination socket asserted SOCK_PASSCRED. The original implememtation in maybe_add_creds is wrong, and breaks several LSB testcases ( i.e. /tset/LSB.os/netowkr/recvfrom/T.recvfrom). Origionally-authored-by: Karel Srot <ksrot@redhat.com> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/unix/af_unix.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index f153a8d..971282b 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1412,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();
}
OpenPOWER on IntegriCloud