From: Eric W. Biederman Date: Sun, 28 Feb 2010 01:20:36 +0000 (+0000) Subject: scm: Only support SCM_RIGHTS on unix domain sockets. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=76dadd76c265a0cdb5a76aa4eef03fcc9639b388;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git scm: Only support SCM_RIGHTS on unix domain sockets. We use scm_send and scm_recv on both unix domain and netlink sockets, but only unix domain sockets support everything required for file descriptor passing, so error if someone attempts to pass file descriptors over netlink sockets. Cc: stable@kernel.org Signed-off-by: Eric W. Biederman Signed-off-by: David S. Miller --- diff --git a/net/core/scm.c b/net/core/scm.c index b7ba91b074b3..9b264634acfd 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -156,6 +156,8 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p) switch (cmsg->cmsg_type) { case SCM_RIGHTS: + if (!sock->ops || sock->ops->family != PF_UNIX) + goto error; err=scm_fp_copy(cmsg, &p->fp); if (err<0) goto error;