aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xattr.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-10-11 03:56:12 -0400
committerJeff Garzik <jeff@garzik.org>2006-10-11 03:56:12 -0400
commit24fcbacedb0d83cabc6761acbecfbf751265ce52 (patch)
tree7147b206304b028c3cfd5de6317e5c8510098ca9 /fs/xattr.c
parent2f614fe04f4463ff22234133319067d7361f54e5 (diff)
parent53a5fbdc2dff55161a206ed1a1385a8fa8055c34 (diff)
Merge branch 'master' into upstream-fixes
Diffstat (limited to 'fs/xattr.c')
-rw-r--r--fs/xattr.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/fs/xattr.c b/fs/xattr.c
index c32f15b5f60f..395635100f77 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -135,6 +135,26 @@ vfs_getxattr(struct dentry *dentry, char *name, void *value, size_t size)
135} 135}
136EXPORT_SYMBOL_GPL(vfs_getxattr); 136EXPORT_SYMBOL_GPL(vfs_getxattr);
137 137
138ssize_t
139vfs_listxattr(struct dentry *d, char *list, size_t size)
140{
141 ssize_t error;
142
143 error = security_inode_listxattr(d);
144 if (error)
145 return error;
146 error = -EOPNOTSUPP;
147 if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
148 error = d->d_inode->i_op->listxattr(d, list, size);
149 } else {
150 error = security_inode_listsecurity(d->d_inode, list, size);
151 if (size && error > size)
152 error = -ERANGE;
153 }
154 return error;
155}
156EXPORT_SYMBOL_GPL(vfs_listxattr);
157
138int 158int
139vfs_removexattr(struct dentry *dentry, char *name) 159vfs_removexattr(struct dentry *dentry, char *name)
140{ 160{
@@ -346,17 +366,7 @@ listxattr(struct dentry *d, char __user *list, size_t size)
346 return -ENOMEM; 366 return -ENOMEM;
347 } 367 }
348 368
349 error = security_inode_listxattr(d); 369 error = vfs_listxattr(d, klist, size);
350 if (error)
351 goto out;
352 error = -EOPNOTSUPP;
353 if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
354 error = d->d_inode->i_op->listxattr(d, klist, size);
355 } else {
356 error = security_inode_listsecurity(d->d_inode, klist, size);
357 if (size && error > size)
358 error = -ERANGE;
359 }
360 if (error > 0) { 370 if (error > 0) {
361 if (size && copy_to_user(list, klist, error)) 371 if (size && copy_to_user(list, klist, error))
362 error = -EFAULT; 372 error = -EFAULT;
@@ -365,7 +375,6 @@ listxattr(struct dentry *d, char __user *list, size_t size)
365 than XATTR_LIST_MAX bytes. Not possible. */ 375 than XATTR_LIST_MAX bytes. Not possible. */
366 error = -E2BIG; 376 error = -E2BIG;
367 } 377 }
368out:
369 kfree(klist); 378 kfree(klist);
370 return error; 379 return error;
371} 380}