]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/core/scm.c
scm: Only support SCM_RIGHTS on unix domain sockets.
[net-next-2.6.git] / net / core / scm.c
index b7ba91b074b33995deee5278fb54c30d100d041b..9b264634acfd6233ebfa7369cc4537638377d06d 100644 (file)
@@ -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;