1
From: Tony Jones <tonyj@suse.de>
2
Subject: Add a struct vfsmount parameter to vfs_listxattr()
4
The vfsmount will be passed down to the LSM hook so that LSMs can compute
7
Signed-off-by: Tony Jones <tonyj@suse.de>
8
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
9
Signed-off-by: John Johansen <jjohansen@suse.de>
12
fs/xattr.c | 25 ++++++++++++++-----------
13
include/linux/xattr.h | 2 +-
14
2 files changed, 15 insertions(+), 12 deletions(-)
18
@@ -168,18 +168,20 @@ nolsm:
19
EXPORT_SYMBOL_GPL(vfs_getxattr);
22
-vfs_listxattr(struct dentry *d, char *list, size_t size)
23
+vfs_listxattr(struct dentry *dentry, struct vfsmount *mnt, char *list,
26
+ struct inode *inode = dentry->d_inode;
29
- error = security_inode_listxattr(d);
30
+ error = security_inode_listxattr(dentry);
34
- if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
35
- error = d->d_inode->i_op->listxattr(d, list, size);
37
- error = security_inode_listsecurity(d->d_inode, list, size);
38
+ if (inode->i_op && inode->i_op->listxattr)
39
+ error = inode->i_op->listxattr(dentry, list, size);
41
+ error = security_inode_listsecurity(inode, list, size);
42
if (size && error > size)
45
@@ -399,7 +401,8 @@ sys_fgetxattr(int fd, const char __user
46
* Extended attribute LIST operations
49
-listxattr(struct dentry *d, char __user *list, size_t size)
50
+listxattr(struct dentry *dentry, struct vfsmount *mnt, char __user *list,
55
@@ -412,7 +415,7 @@ listxattr(struct dentry *d, char __user
59
- error = vfs_listxattr(d, klist, size);
60
+ error = vfs_listxattr(dentry, mnt, klist, size);
62
if (size && copy_to_user(list, klist, error))
64
@@ -434,7 +437,7 @@ sys_listxattr(const char __user *pathnam
65
error = user_path(pathname, &path);
68
- error = listxattr(path.dentry, list, size);
69
+ error = listxattr(path.dentry, path.mnt, list, size);
73
@@ -448,7 +451,7 @@ sys_llistxattr(const char __user *pathna
74
error = user_lpath(pathname, &path);
77
- error = listxattr(path.dentry, list, size);
78
+ error = listxattr(path.dentry, path.mnt, list, size);
82
@@ -463,7 +466,7 @@ sys_flistxattr(int fd, char __user *list
85
audit_inode(NULL, f->f_path.dentry);
86
- error = listxattr(f->f_path.dentry, list, size);
87
+ error = listxattr(f->f_path.dentry, f->f_path.mnt, list, size);
91
--- a/include/linux/xattr.h
92
+++ b/include/linux/xattr.h
93
@@ -49,7 +49,7 @@ struct xattr_handler {
95
ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
96
ssize_t vfs_getxattr(struct dentry *, struct vfsmount *, const char *, void *, size_t);
97
-ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
98
+ssize_t vfs_listxattr(struct dentry *d, struct vfsmount *, char *list, size_t size);
99
int vfs_setxattr(struct dentry *, struct vfsmount *, const char *, const void *, size_t, int);
100
int vfs_removexattr(struct dentry *, const char *);