aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric W. Biederman2013-04-03 11:14:47 -0500
committerGreg Kroah-Hartman2013-05-01 11:46:17 -0500
commitbb85e599d460dc0e59b17abe8e6a906c5d7bcfae (patch)
tree812d2ccadd3a8a71ce0d7917d9120d07c5ac312b /net
parent4833451a2cc02dd929339753e84158232e1baccf (diff)
downloadkernel-video-bb85e599d460dc0e59b17abe8e6a906c5d7bcfae.tar.gz
kernel-video-bb85e599d460dc0e59b17abe8e6a906c5d7bcfae.tar.xz
kernel-video-bb85e599d460dc0e59b17abe8e6a906c5d7bcfae.zip
af_unix: If we don't care about credentials coallesce all messages
[ Upstream commit 0e82e7f6dfeec1013339612f74abc2cdd29d43d2 ] It was reported that the following LSB test case failed https://lsbbugs.linuxfoundation.org/attachment.cgi?id=2144 because we were not coallescing unix stream messages when the application was expecting us to. The problem was that the first send was before the socket was accepted and thus sock->sk_socket was NULL in maybe_add_creds, and the second send after the socket was accepted had a non-NULL value for sk->socket and thus we could tell the credentials were not needed so we did not bother. The unnecessary credentials on the first message cause unix_stream_recvmsg to start verifying that all messages had the same credentials before coallescing and then the coallescing failed because the second message had no credentials. Ignoring credentials when we don't care in unix_stream_recvmsg fixes a long standing pessimization which would fail to coallesce messages when reading from a unix stream socket if the senders were different even if we did not care about their credentials. I have tested this and verified that the in the LSB test case mentioned above that the messages do coallesce now, while the were failing to coallesce without this change. Reported-by: Karel Srot <ksrot@redhat.com> Reported-by: Ding Tianhong <dingtianhong@huawei.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/unix/af_unix.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index b45eb6553ee..f347754e462 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1995,7 +1995,7 @@ again:
1995 if ((UNIXCB(skb).pid != siocb->scm->pid) || 1995 if ((UNIXCB(skb).pid != siocb->scm->pid) ||
1996 (UNIXCB(skb).cred != siocb->scm->cred)) 1996 (UNIXCB(skb).cred != siocb->scm->cred))
1997 break; 1997 break;
1998 } else { 1998 } else if (test_bit(SOCK_PASSCRED, &sock->flags)) {
1999 /* Copy credentials */ 1999 /* Copy credentials */
2000 scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred); 2000 scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred);
2001 check_creds = 1; 2001 check_creds = 1;