]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.apparmor/vfs-listxattr.diff
Revert "Move xen patchset to new version's subdir."
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.apparmor / vfs-listxattr.diff
1 From: Tony Jones <tonyj@suse.de>
2 Subject: Add a struct vfsmount parameter to vfs_listxattr()
3
4 The vfsmount will be passed down to the LSM hook so that LSMs can compute
5 pathnames.
6
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>
10
11 ---
12 fs/xattr.c | 25 ++++++++++++++-----------
13 include/linux/xattr.h | 2 +-
14 2 files changed, 15 insertions(+), 12 deletions(-)
15
16 --- a/fs/xattr.c
17 +++ b/fs/xattr.c
18 @@ -168,18 +168,20 @@ nolsm:
19 EXPORT_SYMBOL_GPL(vfs_getxattr);
20
21 ssize_t
22 -vfs_listxattr(struct dentry *d, char *list, size_t size)
23 +vfs_listxattr(struct dentry *dentry, struct vfsmount *mnt, char *list,
24 + size_t size)
25 {
26 + struct inode *inode = dentry->d_inode;
27 ssize_t error;
28
29 - error = security_inode_listxattr(d);
30 + error = security_inode_listxattr(dentry);
31 if (error)
32 return error;
33 error = -EOPNOTSUPP;
34 - if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
35 - error = d->d_inode->i_op->listxattr(d, list, size);
36 - } else {
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);
40 + else {
41 + error = security_inode_listsecurity(inode, list, size);
42 if (size && error > size)
43 error = -ERANGE;
44 }
45 @@ -396,7 +398,8 @@ SYSCALL_DEFINE4(fgetxattr, int, fd, cons
46 * Extended attribute LIST operations
47 */
48 static ssize_t
49 -listxattr(struct dentry *d, char __user *list, size_t size)
50 +listxattr(struct dentry *dentry, struct vfsmount *mnt, char __user *list,
51 + size_t size)
52 {
53 ssize_t error;
54 char *klist = NULL;
55 @@ -409,7 +412,7 @@ listxattr(struct dentry *d, char __user
56 return -ENOMEM;
57 }
58
59 - error = vfs_listxattr(d, klist, size);
60 + error = vfs_listxattr(dentry, mnt, klist, size);
61 if (error > 0) {
62 if (size && copy_to_user(list, klist, error))
63 error = -EFAULT;
64 @@ -431,7 +434,7 @@ SYSCALL_DEFINE3(listxattr, const char __
65 error = user_path(pathname, &path);
66 if (error)
67 return error;
68 - error = listxattr(path.dentry, list, size);
69 + error = listxattr(path.dentry, path.mnt, list, size);
70 path_put(&path);
71 return error;
72 }
73 @@ -445,7 +448,7 @@ SYSCALL_DEFINE3(llistxattr, const char _
74 error = user_lpath(pathname, &path);
75 if (error)
76 return error;
77 - error = listxattr(path.dentry, list, size);
78 + error = listxattr(path.dentry, path.mnt, list, size);
79 path_put(&path);
80 return error;
81 }
82 @@ -459,7 +462,7 @@ SYSCALL_DEFINE3(flistxattr, int, fd, cha
83 if (!f)
84 return error;
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);
88 fput(f);
89 return error;
90 }
91 --- a/include/linux/xattr.h
92 +++ b/include/linux/xattr.h
93 @@ -49,7 +49,7 @@ struct xattr_handler {
94
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 *);
101