sock: ignore SCM_RIGHTS and SCM_CREDENTIALS in __sock_cmsg_send
Subsystems (3)
PATCH v2 1/1 sock: ignore SCM_RIGHTS and SCM_CREDENTIALS in __sock_cmsg_send
From: Soheil Hassas Yeganeh <[email protected]>
Sergei Trofimovich reported that pulse audio sends SCM_CREDENTIALS as a control message to TCP. Since __sock_cmsg_send does not support SCM_RIGHTS and SCM_CREDENTIALS, it returns an error and hence breaks pulse audio over TCP.
SCM_RIGHTS and SCM_CREDENTIALS are sent on the SOL_SOCKET layer but they semantically belong to SOL_UNIX. Since all cmsg-processing functions including sock_cmsg_send ignore control messages of other layers, it is best to ignore SCM_RIGHTS and SCM_CREDENTIALS for consistency (and also for fixing pulse audio over TCP).
--- net/core/sock.c | 4 ++++ 1 file changed, 4 insertions(+)
net/core/sock.c +4 -0
@@ -1938,6 +1938,10 @@ int __sock_cmsg_send(struct sock *sk, struct msghdr *msg, struct cmsghdr *cmsg, sockc->tsflags &= ~SOF_TIMESTAMPING_TX_RECORD_MASK ; sockc->tsflags |= tsflags;break ; +/* SCM_RIGHTS and SCM_CREDENTIALS are semantically in SOL_UNIX. */ +case SCM_RIGHTS : +case SCM_CREDENTIALS : +break ;default :return -EINVAL ; }
Signature · 1 line
2.8.0.rc3.226.g39d4020
David Miller
maintainerFrom: Soheil Hassas Yeganeh <[email protected]>
Date: Mon, 11 Jul 2016 16:51:26 -0400
Quoted 14 lines
From: Soheil Hassas Yeganeh <[email protected]>
Sergei Trofimovich reported that pulse audio sends
SCM_CREDENTIALSas a control message to TCP. Since__sock_cmsg_senddoes not supportSCM_RIGHTSandSCM_CREDENTIALS, it returns an error and hence breaks pulse audio over TCP.
SCM_RIGHTSandSCM_CREDENTIALSare sent on theSOL_SOCKETlayer but they semantically belong toSOL_UNIX. Since all cmsg-processing functions includingsock_cmsg_sendignore control messages of other layers, it is best to ignoreSCM_RIGHTSandSCM_CREDENTIALSfor consistency (and also for fixing pulse audio over TCP).
Quoted 4 lines
Fixes c14ac9451c34 ("sock: enable timestamping using control messages")Signed-off-by Soheil Hassas Yeganeh <[email protected]>Reported-by Sergei Trofimovich <[email protected]>Tested-by Sergei Trofimovich <[email protected]>
Applied and queued up for -stable, thanks.