]>
Commit | Line | Data |
---|---|---|
6a930a95 BS |
1 | From: Tony Jones <tonyj@suse.de> |
2 | Subject: Add a struct vfsmount parameter to vfs_removexattr() | |
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/nfsd/vfs.c | 11 ++++++----- | |
13 | fs/xattr.c | 12 ++++++------ | |
14 | include/linux/xattr.h | 2 +- | |
15 | 3 files changed, 13 insertions(+), 12 deletions(-) | |
16 | ||
17 | Index: linux-2.6.27/fs/nfsd/vfs.c | |
18 | =================================================================== | |
19 | --- linux-2.6.27.orig/fs/nfsd/vfs.c | |
20 | +++ linux-2.6.27/fs/nfsd/vfs.c | |
21 | @@ -2095,6 +2095,7 @@ nfsd_get_posix_acl(struct svc_fh *fhp, i | |
22 | int | |
23 | nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl) | |
24 | { | |
25 | + struct vfsmount *mnt; | |
26 | struct inode *inode = fhp->fh_dentry->d_inode; | |
27 | char *name; | |
28 | void *value = NULL; | |
29 | @@ -2127,22 +2128,22 @@ nfsd_set_posix_acl(struct svc_fh *fhp, i | |
30 | } else | |
31 | size = 0; | |
32 | ||
33 | - error = mnt_want_write(fhp->fh_export->ex_path.mnt); | |
34 | + mnt = fhp->fh_export->ex_path.mnt; | |
35 | + error = mnt_want_write(mnt); | |
36 | if (error) | |
37 | goto getout; | |
38 | if (size) | |
39 | - error = vfs_setxattr(fhp->fh_dentry, fhp->fh_export->ex_path.mnt, | |
40 | - name, value, size,0); | |
41 | + error = vfs_setxattr(fhp->fh_dentry, mnt, name, value, size,0); | |
42 | else { | |
43 | if (!S_ISDIR(inode->i_mode) && type == ACL_TYPE_DEFAULT) | |
44 | error = 0; | |
45 | else { | |
46 | - error = vfs_removexattr(fhp->fh_dentry, name); | |
47 | + error = vfs_removexattr(fhp->fh_dentry, mnt, name); | |
48 | if (error == -ENODATA) | |
49 | error = 0; | |
50 | } | |
51 | } | |
52 | - mnt_drop_write(fhp->fh_export->ex_path.mnt); | |
53 | + mnt_drop_write(mnt); | |
54 | ||
55 | getout: | |
56 | kfree(value); | |
57 | Index: linux-2.6.27/fs/xattr.c | |
58 | =================================================================== | |
59 | --- linux-2.6.27.orig/fs/xattr.c | |
60 | +++ linux-2.6.27/fs/xattr.c | |
61 | @@ -190,7 +190,7 @@ vfs_listxattr(struct dentry *dentry, str | |
62 | EXPORT_SYMBOL_GPL(vfs_listxattr); | |
63 | ||
64 | int | |
65 | -vfs_removexattr(struct dentry *dentry, const char *name) | |
66 | +vfs_removexattr(struct dentry *dentry, struct vfsmount *mnt, const char *name) | |
67 | { | |
68 | struct inode *inode = dentry->d_inode; | |
69 | int error; | |
70 | @@ -471,7 +471,7 @@ SYSCALL_DEFINE3(flistxattr, int, fd, cha | |
71 | * Extended attribute REMOVE operations | |
72 | */ | |
73 | static long | |
74 | -removexattr(struct dentry *d, const char __user *name) | |
75 | +removexattr(struct dentry *dentry, struct vfsmount *mnt, const char __user *name) | |
76 | { | |
77 | int error; | |
78 | char kname[XATTR_NAME_MAX + 1]; | |
79 | @@ -482,7 +482,7 @@ removexattr(struct dentry *d, const char | |
80 | if (error < 0) | |
81 | return error; | |
82 | ||
83 | - return vfs_removexattr(d, kname); | |
84 | + return vfs_removexattr(dentry, mnt, kname); | |
85 | } | |
86 | ||
87 | SYSCALL_DEFINE2(removexattr, const char __user *, pathname, | |
88 | @@ -496,7 +496,7 @@ SYSCALL_DEFINE2(removexattr, const char | |
89 | return error; | |
90 | error = mnt_want_write(path.mnt); | |
91 | if (!error) { | |
92 | - error = removexattr(path.dentry, name); | |
93 | + error = removexattr(path.dentry, path.mnt, name); | |
94 | mnt_drop_write(path.mnt); | |
95 | } | |
96 | path_put(&path); | |
97 | @@ -514,7 +514,7 @@ SYSCALL_DEFINE2(lremovexattr, const char | |
98 | return error; | |
99 | error = mnt_want_write(path.mnt); | |
100 | if (!error) { | |
101 | - error = removexattr(path.dentry, name); | |
102 | + error = removexattr(path.dentry, path.mnt, name); | |
103 | mnt_drop_write(path.mnt); | |
104 | } | |
105 | path_put(&path); | |
106 | @@ -534,7 +534,7 @@ SYSCALL_DEFINE2(fremovexattr, int, fd, c | |
107 | audit_inode(NULL, dentry); | |
108 | error = mnt_want_write_file(f->f_path.mnt, f); | |
109 | if (!error) { | |
110 | - error = removexattr(dentry, name); | |
111 | + error = removexattr(dentry, f->f_path.mnt, name); | |
112 | mnt_drop_write(f->f_path.mnt); | |
113 | } | |
114 | fput(f); | |
115 | Index: linux-2.6.27/include/linux/xattr.h | |
116 | =================================================================== | |
117 | --- linux-2.6.27.orig/include/linux/xattr.h | |
118 | +++ linux-2.6.27/include/linux/xattr.h | |
119 | @@ -51,7 +51,7 @@ ssize_t xattr_getsecurity(struct inode * | |
120 | ssize_t vfs_getxattr(struct dentry *, struct vfsmount *, const char *, void *, size_t); | |
121 | ssize_t vfs_listxattr(struct dentry *d, struct vfsmount *, char *list, size_t size); | |
122 | int vfs_setxattr(struct dentry *, struct vfsmount *, const char *, const void *, size_t, int); | |
123 | -int vfs_removexattr(struct dentry *, const char *); | |
124 | +int vfs_removexattr(struct dentry *, struct vfsmount *mnt, const char *); | |
125 | ||
126 | ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size); | |
127 | ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); |