Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 39167
b: refs/heads/master
c: 659564c
h: refs/heads/master
i:
  39165: 7d5af23
  39163: 98a8e35
  39159: ef1f0d8
  39151: 9978493
  39135: 2138684
  39103: d137871
  39039: 6f11519
  38911: 270a202
v: v3
  • Loading branch information
Bill Nottingham authored and Linus Torvalds committed Oct 9, 2006
1 parent c14b0aa commit d078a26
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e069d79d23739977800c3b8495853b735f77ef30
refs/heads/master: 659564c8adfe1765476beee8d55cd18986946892
33 changes: 21 additions & 12 deletions trunk/fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,26 @@ vfs_getxattr(struct dentry *dentry, char *name, void *value, size_t size)
}
EXPORT_SYMBOL_GPL(vfs_getxattr);

ssize_t
vfs_listxattr(struct dentry *d, char *list, size_t size)
{
ssize_t error;

error = security_inode_listxattr(d);
if (error)
return error;
error = -EOPNOTSUPP;
if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
error = d->d_inode->i_op->listxattr(d, list, size);
} else {
error = security_inode_listsecurity(d->d_inode, list, size);
if (size && error > size)
error = -ERANGE;
}
return error;
}
EXPORT_SYMBOL_GPL(vfs_listxattr);

int
vfs_removexattr(struct dentry *dentry, char *name)
{
Expand Down Expand Up @@ -346,17 +366,7 @@ listxattr(struct dentry *d, char __user *list, size_t size)
return -ENOMEM;
}

error = security_inode_listxattr(d);
if (error)
goto out;
error = -EOPNOTSUPP;
if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
error = d->d_inode->i_op->listxattr(d, klist, size);
} else {
error = security_inode_listsecurity(d->d_inode, klist, size);
if (size && error > size)
error = -ERANGE;
}
error = vfs_listxattr(d, klist, size);
if (error > 0) {
if (size && copy_to_user(list, klist, error))
error = -EFAULT;
Expand All @@ -365,7 +375,6 @@ listxattr(struct dentry *d, char __user *list, size_t size)
than XATTR_LIST_MAX bytes. Not possible. */
error = -E2BIG;
}
out:
kfree(klist);
return error;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/xattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct xattr_handler {
};

ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t);
ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
int vfs_setxattr(struct dentry *, char *, void *, size_t, int);
int vfs_removexattr(struct dentry *, char *);

Expand Down

0 comments on commit d078a26

Please sign in to comment.