提交 bf3ee713 编写于 作者: A Andreas Gruenbacher 提交者: Al Viro

vfs: Check for the IOP_XATTR flag in listxattr

When an inode doesn't support xattrs, turn listxattr off as well.

(When xattrs are "turned off", the VFS still passes security xattr
operations through to security modules, which can still expose inode
security labels that way.)
Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 5d6c3191
...@@ -326,18 +326,19 @@ vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) ...@@ -326,18 +326,19 @@ vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size)
EXPORT_SYMBOL_GPL(vfs_getxattr); EXPORT_SYMBOL_GPL(vfs_getxattr);
ssize_t ssize_t
vfs_listxattr(struct dentry *d, char *list, size_t size) vfs_listxattr(struct dentry *dentry, char *list, size_t size)
{ {
struct inode *inode = d_inode(dentry);
ssize_t error; ssize_t error;
error = security_inode_listxattr(d); error = security_inode_listxattr(dentry);
if (error) if (error)
return error; return error;
error = -EOPNOTSUPP; if (inode->i_op->listxattr && (inode->i_opflags & IOP_XATTR)) {
if (d->d_inode->i_op->listxattr) { error = -EOPNOTSUPP;
error = d->d_inode->i_op->listxattr(d, list, size); error = inode->i_op->listxattr(dentry, list, size);
} else { } else {
error = security_inode_listsecurity(d->d_inode, list, size); error = security_inode_listsecurity(inode, list, size);
if (size && error > size) if (size && error > size)
error = -ERANGE; error = -ERANGE;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册