mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-05 00:41:03 +01:00
122 lines
3.9 KiB
Diff
122 lines
3.9 KiB
Diff
![]() |
From: Tony Jones <tonyj@suse.de>
|
||
|
Subject: Add a struct vfsmount parameter to vfs_removexattr()
|
||
|
|
||
|
The vfsmount will be passed down to the LSM hook so that LSMs can compute
|
||
|
pathnames.
|
||
|
|
||
|
Signed-off-by: Tony Jones <tonyj@suse.de>
|
||
|
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
|
||
|
Signed-off-by: John Johansen <jjohansen@suse.de>
|
||
|
|
||
|
---
|
||
|
fs/nfsd/vfs.c | 11 ++++++-----
|
||
|
fs/xattr.c | 12 ++++++------
|
||
|
include/linux/xattr.h | 2 +-
|
||
|
3 files changed, 13 insertions(+), 12 deletions(-)
|
||
|
|
||
|
--- a/fs/nfsd/vfs.c
|
||
|
+++ b/fs/nfsd/vfs.c
|
||
|
@@ -2073,6 +2073,7 @@ nfsd_get_posix_acl(struct svc_fh *fhp, i
|
||
|
int
|
||
|
nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl)
|
||
|
{
|
||
|
+ struct vfsmount *mnt;
|
||
|
struct inode *inode = fhp->fh_dentry->d_inode;
|
||
|
char *name;
|
||
|
void *value = NULL;
|
||
|
@@ -2105,22 +2106,22 @@ nfsd_set_posix_acl(struct svc_fh *fhp, i
|
||
|
} else
|
||
|
size = 0;
|
||
|
|
||
|
- error = mnt_want_write(fhp->fh_export->ex_path.mnt);
|
||
|
+ mnt = fhp->fh_export->ex_path.mnt;
|
||
|
+ error = mnt_want_write(mnt);
|
||
|
if (error)
|
||
|
goto getout;
|
||
|
if (size)
|
||
|
- error = vfs_setxattr(fhp->fh_dentry, fhp->fh_export->ex_path.mnt,
|
||
|
- name, value, size,0);
|
||
|
+ error = vfs_setxattr(fhp->fh_dentry, mnt, name, value, size,0);
|
||
|
else {
|
||
|
if (!S_ISDIR(inode->i_mode) && type == ACL_TYPE_DEFAULT)
|
||
|
error = 0;
|
||
|
else {
|
||
|
- error = vfs_removexattr(fhp->fh_dentry, name);
|
||
|
+ error = vfs_removexattr(fhp->fh_dentry, mnt, name);
|
||
|
if (error == -ENODATA)
|
||
|
error = 0;
|
||
|
}
|
||
|
}
|
||
|
- mnt_drop_write(fhp->fh_export->ex_path.mnt);
|
||
|
+ mnt_drop_write(mnt);
|
||
|
|
||
|
getout:
|
||
|
kfree(value);
|
||
|
--- a/fs/xattr.c
|
||
|
+++ b/fs/xattr.c
|
||
|
@@ -190,7 +190,7 @@ vfs_listxattr(struct dentry *dentry, str
|
||
|
EXPORT_SYMBOL_GPL(vfs_listxattr);
|
||
|
|
||
|
int
|
||
|
-vfs_removexattr(struct dentry *dentry, const char *name)
|
||
|
+vfs_removexattr(struct dentry *dentry, struct vfsmount *mnt, const char *name)
|
||
|
{
|
||
|
struct inode *inode = dentry->d_inode;
|
||
|
int error;
|
||
|
@@ -475,7 +475,7 @@ sys_flistxattr(int fd, char __user *list
|
||
|
* Extended attribute REMOVE operations
|
||
|
*/
|
||
|
static long
|
||
|
-removexattr(struct dentry *d, const char __user *name)
|
||
|
+removexattr(struct dentry *dentry, struct vfsmount *mnt, const char __user *name)
|
||
|
{
|
||
|
int error;
|
||
|
char kname[XATTR_NAME_MAX + 1];
|
||
|
@@ -486,7 +486,7 @@ removexattr(struct dentry *d, const char
|
||
|
if (error < 0)
|
||
|
return error;
|
||
|
|
||
|
- return vfs_removexattr(d, kname);
|
||
|
+ return vfs_removexattr(dentry, mnt, kname);
|
||
|
}
|
||
|
|
||
|
asmlinkage long
|
||
|
@@ -500,7 +500,7 @@ sys_removexattr(const char __user *path,
|
||
|
return error;
|
||
|
error = mnt_want_write(nd.path.mnt);
|
||
|
if (!error) {
|
||
|
- error = removexattr(nd.path.dentry, name);
|
||
|
+ error = removexattr(nd.path.dentry, nd.path.mnt, name);
|
||
|
mnt_drop_write(nd.path.mnt);
|
||
|
}
|
||
|
path_put(&nd.path);
|
||
|
@@ -518,7 +518,7 @@ sys_lremovexattr(const char __user *path
|
||
|
return error;
|
||
|
error = mnt_want_write(nd.path.mnt);
|
||
|
if (!error) {
|
||
|
- error = removexattr(nd.path.dentry, name);
|
||
|
+ error = removexattr(nd.path.dentry, nd.path.mnt, name);
|
||
|
mnt_drop_write(nd.path.mnt);
|
||
|
}
|
||
|
path_put(&nd.path);
|
||
|
@@ -539,7 +539,7 @@ sys_fremovexattr(int fd, const char __us
|
||
|
audit_inode(NULL, dentry);
|
||
|
error = mnt_want_write(f->f_path.mnt);
|
||
|
if (!error) {
|
||
|
- error = removexattr(dentry, name);
|
||
|
+ error = removexattr(dentry, f->f_path.mnt, name);
|
||
|
mnt_drop_write(f->f_path.mnt);
|
||
|
}
|
||
|
fput(f);
|
||
|
--- a/include/linux/xattr.h
|
||
|
+++ b/include/linux/xattr.h
|
||
|
@@ -50,7 +50,7 @@ ssize_t xattr_getsecurity(struct inode *
|
||
|
ssize_t vfs_getxattr(struct dentry *, struct vfsmount *, const char *, void *, size_t);
|
||
|
ssize_t vfs_listxattr(struct dentry *d, struct vfsmount *, char *list, size_t size);
|
||
|
int vfs_setxattr(struct dentry *, struct vfsmount *, const char *, const void *, size_t, int);
|
||
|
-int vfs_removexattr(struct dentry *, const char *);
|
||
|
+int vfs_removexattr(struct dentry *, struct vfsmount *mnt, const char *);
|
||
|
|
||
|
ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);
|
||
|
ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
|