diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-02-28 01:20:36 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-15 08:49:58 -0700 |
commit | c6476d517ed62121444df6e3cbf7a494a463a74d (patch) | |
tree | e5e521e7c076b5cc5518da30802ccce2c9d5edc2 | |
parent | ca652afbb2e2ff892286846075380a505cec583a (diff) | |
download | lwn-c6476d517ed62121444df6e3cbf7a494a463a74d.tar.gz lwn-c6476d517ed62121444df6e3cbf7a494a463a74d.zip |
scm: Only support SCM_RIGHTS on unix domain sockets.
commit 76dadd76c265a0cdb5a76aa4eef03fcc9639b388 upstream.
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.
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@suse.de>
-rw-r--r-- | net/core/scm.c | 2 |
1 files changed, 2 insertions, 0 deletions
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; |