diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-17 16:49:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-17 16:49:30 -0500 |
commit | bec1b089ab287d5df160205f5949114e5a3d3162 (patch) | |
tree | 15b0f849a45ee661e65bc3a07c13d129f4de0221 /fs | |
parent | d46bc34da9bcdab815c4972ad0d433af8eb98c8a (diff) | |
parent | 680bb946a1ae04fe0ff369a4965f76b48c07dc54 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs fixes from Al Viro:
"A couple of regression fixes"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
fix iov_iter_advance() for ITER_PIPE
xattr: Fix setting security xattrs on sockfs
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xattr.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/xattr.c b/fs/xattr.c index 3368659c471e..2d13b4e62fae 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
@@ -170,7 +170,7 @@ int __vfs_setxattr_noperm(struct dentry *dentry, const char *name, | |||
170 | const void *value, size_t size, int flags) | 170 | const void *value, size_t size, int flags) |
171 | { | 171 | { |
172 | struct inode *inode = dentry->d_inode; | 172 | struct inode *inode = dentry->d_inode; |
173 | int error = -EOPNOTSUPP; | 173 | int error = -EAGAIN; |
174 | int issec = !strncmp(name, XATTR_SECURITY_PREFIX, | 174 | int issec = !strncmp(name, XATTR_SECURITY_PREFIX, |
175 | XATTR_SECURITY_PREFIX_LEN); | 175 | XATTR_SECURITY_PREFIX_LEN); |
176 | 176 | ||
@@ -183,15 +183,21 @@ int __vfs_setxattr_noperm(struct dentry *dentry, const char *name, | |||
183 | security_inode_post_setxattr(dentry, name, value, | 183 | security_inode_post_setxattr(dentry, name, value, |
184 | size, flags); | 184 | size, flags); |
185 | } | 185 | } |
186 | } else if (issec) { | 186 | } else { |
187 | const char *suffix = name + XATTR_SECURITY_PREFIX_LEN; | ||
188 | |||
189 | if (unlikely(is_bad_inode(inode))) | 187 | if (unlikely(is_bad_inode(inode))) |
190 | return -EIO; | 188 | return -EIO; |
191 | error = security_inode_setsecurity(inode, suffix, value, | 189 | } |
192 | size, flags); | 190 | if (error == -EAGAIN) { |
193 | if (!error) | 191 | error = -EOPNOTSUPP; |
194 | fsnotify_xattr(dentry); | 192 | |
193 | if (issec) { | ||
194 | const char *suffix = name + XATTR_SECURITY_PREFIX_LEN; | ||
195 | |||
196 | error = security_inode_setsecurity(inode, suffix, value, | ||
197 | size, flags); | ||
198 | if (!error) | ||
199 | fsnotify_xattr(dentry); | ||
200 | } | ||
195 | } | 201 | } |
196 | 202 | ||
197 | return error; | 203 | return error; |