diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-13 17:08:22 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-15 02:21:45 -0400 |
commit | 326be7b484843988afe57566b627fb7a70beac56 (patch) | |
tree | 04a15bfdb681ad09444cf2f3d72ae0d38fb0432b /net | |
parent | 65cfc6722361570bfe255698d9cd4dccaf47570d (diff) |
Allow passing O_PATH descriptors via SCM_RIGHTS datagrams
Just need to make sure that AF_UNIX garbage collector won't
confuse O_PATHed socket on filesystem for real AF_UNIX opened
socket.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/scm.c | 2 | ||||
-rw-r--r-- | net/unix/garbage.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/net/core/scm.c b/net/core/scm.c index bbe454450801..4c1ef026d695 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -95,7 +95,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) | |||
95 | int fd = fdp[i]; | 95 | int fd = fdp[i]; |
96 | struct file *file; | 96 | struct file *file; |
97 | 97 | ||
98 | if (fd < 0 || !(file = fget(fd))) | 98 | if (fd < 0 || !(file = fget_raw(fd))) |
99 | return -EBADF; | 99 | return -EBADF; |
100 | *fpp++ = file; | 100 | *fpp++ = file; |
101 | fpl->count++; | 101 | fpl->count++; |
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index f89f83bf828e..b6f4b994eb35 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -104,7 +104,7 @@ struct sock *unix_get_socket(struct file *filp) | |||
104 | /* | 104 | /* |
105 | * Socket ? | 105 | * Socket ? |
106 | */ | 106 | */ |
107 | if (S_ISSOCK(inode->i_mode)) { | 107 | if (S_ISSOCK(inode->i_mode) && !(filp->f_mode & FMODE_PATH)) { |
108 | struct socket *sock = SOCKET_I(inode); | 108 | struct socket *sock = SOCKET_I(inode); |
109 | struct sock *s = sock->sk; | 109 | struct sock *s = sock->sk; |
110 | 110 | ||