fs: port ->set_acl() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888 Status: Linus Conflicts: For consistency drop btrfs hunks because it isn't supported in CentOS Stream and other backports also drop such hunks. The cifs source has been moved in CentOS Stream so manually apply rejected hunks to fs/smb/client/cifsacl.c and fs/smb/client/cifsproto.h. Dropped hunks for ntfs3 and ksmbd because the source is not present in the CentOS Stream source tree. CentOS Stream commit892da692fa
("shmem: support idmapped mounts for tmpfs") is present, which cuases hunk #1 against mm/shmem.c to be rejected, manually apply the hunk. CentOS Stream commit48fa94aacd
("ceph: fscrypt_auth handling for ceph") is present which causes fuzz 1 of hunk #1 against fs/ceph/inode.c. commit 13e83a4923bea7c4f2f6714030cb7e56d20ef7e5 Author: Christian Brauner <brauner@kernel.org> Date: Fri Jan 13 12:49:20 2023 +0100 fs: port ->set_acl() to pass mnt_idmap Convert to struct mnt_idmap. Last cycle we merged the necessary infrastructure in 256c8aed2b42 ("fs: introduce dedicated idmap type for mounts"). This is just the conversion to struct mnt_idmap. Currently we still pass around the plain namespace that was attached to a mount. This is in general pretty convenient but it makes it easy to conflate namespaces that are relevant on the filesystem with namespaces that are relevent on the mount level. Especially for non-vfs developers without detailed knowledge in this area this can be a potential source for bugs. Once the conversion to struct mnt_idmap is done all helpers down to the really low-level helpers will take a struct mnt_idmap argument instead of two namespace arguments. This way it becomes impossible to conflate the two eliminating the possibility of any bugs. All of the vfs and all filesystems only operate on struct mnt_idmap. Acked-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Ian Kent <ikent@redhat.com>
This commit is contained in:
parent
1176258599
commit
be97228574
|
@ -444,7 +444,7 @@ As of kernel 2.6.22, the following members are defined:
|
||||||
unsigned open_flag, umode_t create_mode);
|
unsigned open_flag, umode_t create_mode);
|
||||||
int (*tmpfile) (struct mnt_idmap *, struct inode *, struct file *, umode_t);
|
int (*tmpfile) (struct mnt_idmap *, struct inode *, struct file *, umode_t);
|
||||||
struct posix_acl * (*get_acl)(struct mnt_idmap *, struct dentry *, int);
|
struct posix_acl * (*get_acl)(struct mnt_idmap *, struct dentry *, int);
|
||||||
int (*set_acl)(struct user_namespace *, struct dentry *, struct posix_acl *, int);
|
int (*set_acl)(struct mnt_idmap *, struct dentry *, struct posix_acl *, int);
|
||||||
int (*fileattr_set)(struct user_namespace *mnt_userns,
|
int (*fileattr_set)(struct user_namespace *mnt_userns,
|
||||||
struct dentry *dentry, struct fileattr *fa);
|
struct dentry *dentry, struct fileattr *fa);
|
||||||
int (*fileattr_get)(struct dentry *dentry, struct fileattr *fa);
|
int (*fileattr_get)(struct dentry *dentry, struct fileattr *fa);
|
||||||
|
|
|
@ -151,7 +151,7 @@ struct posix_acl *v9fs_iop_get_acl(struct mnt_idmap *idmap,
|
||||||
return v9fs_get_cached_acl(d_inode(dentry), type);
|
return v9fs_get_cached_acl(d_inode(dentry), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
int v9fs_iop_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int v9fs_iop_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
|
@ -12,7 +12,7 @@ struct posix_acl *v9fs_iop_get_inode_acl(struct inode *inode, int type,
|
||||||
bool rcu);
|
bool rcu);
|
||||||
struct posix_acl *v9fs_iop_get_acl(struct mnt_idmap *idmap,
|
struct posix_acl *v9fs_iop_get_acl(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, int type);
|
struct dentry *dentry, int type);
|
||||||
int v9fs_iop_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int v9fs_iop_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid);
|
int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid);
|
||||||
int v9fs_set_create_acl(struct inode *inode, struct p9_fid *fid,
|
int v9fs_set_create_acl(struct inode *inode, struct p9_fid *fid,
|
||||||
|
|
|
@ -153,7 +153,7 @@ static int bad_inode_tmpfile(struct mnt_idmap *idmap,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bad_inode_set_acl(struct user_namespace *mnt_userns,
|
static int bad_inode_set_acl(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, struct posix_acl *acl,
|
struct dentry *dentry, struct posix_acl *acl,
|
||||||
int type)
|
int type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,10 +110,11 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int btrfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int btrfs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||||
struct inode *inode = d_inode(dentry);
|
struct inode *inode = d_inode(dentry);
|
||||||
umode_t old_mode = inode->i_mode;
|
umode_t old_mode = inode->i_mode;
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ retry:
|
||||||
return acl;
|
return acl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ceph_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int ceph_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
int ret = 0, size = 0;
|
int ret = 0, size = 0;
|
||||||
|
|
|
@ -2766,7 +2766,7 @@ int ceph_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
err = __ceph_setattr(inode, attr, NULL);
|
err = __ceph_setattr(inode, attr, NULL);
|
||||||
|
|
||||||
if (err >= 0 && (attr->ia_valid & ATTR_MODE))
|
if (err >= 0 && (attr->ia_valid & ATTR_MODE))
|
||||||
err = posix_acl_chmod(&init_user_ns, dentry, attr->ia_mode);
|
err = posix_acl_chmod(&nop_mnt_idmap, dentry, attr->ia_mode);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1175,7 +1175,7 @@ void ceph_release_acl_sec_ctx(struct ceph_acl_sec_ctx *as_ctx);
|
||||||
#ifdef CONFIG_CEPH_FS_POSIX_ACL
|
#ifdef CONFIG_CEPH_FS_POSIX_ACL
|
||||||
|
|
||||||
struct posix_acl *ceph_get_acl(struct inode *, int, bool);
|
struct posix_acl *ceph_get_acl(struct inode *, int, bool);
|
||||||
int ceph_set_acl(struct user_namespace *mnt_userns,
|
int ceph_set_acl(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, struct posix_acl *acl, int type);
|
struct dentry *dentry, struct posix_acl *acl, int type);
|
||||||
int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
|
int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
|
||||||
struct ceph_acl_sec_ctx *as_ctx);
|
struct ceph_acl_sec_ctx *as_ctx);
|
||||||
|
|
|
@ -1129,7 +1129,7 @@ static struct posix_acl *ecryptfs_get_acl(struct mnt_idmap *idmap,
|
||||||
posix_acl_xattr_name(type));
|
posix_acl_xattr_name(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ecryptfs_set_acl(struct user_namespace *mnt_userns,
|
static int ecryptfs_set_acl(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, struct posix_acl *acl,
|
struct dentry *dentry, struct posix_acl *acl,
|
||||||
int type)
|
int type)
|
||||||
{
|
{
|
||||||
|
@ -1137,7 +1137,7 @@ static int ecryptfs_set_acl(struct user_namespace *mnt_userns,
|
||||||
struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
|
struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
|
||||||
struct inode *lower_inode = d_inode(lower_dentry);
|
struct inode *lower_inode = d_inode(lower_dentry);
|
||||||
|
|
||||||
rc = vfs_set_acl(&init_user_ns, lower_dentry,
|
rc = vfs_set_acl(&nop_mnt_idmap, lower_dentry,
|
||||||
posix_acl_xattr_name(type), acl);
|
posix_acl_xattr_name(type), acl);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
fsstack_copy_attr_all(d_inode(dentry), lower_inode);
|
fsstack_copy_attr_all(d_inode(dentry), lower_inode);
|
||||||
|
|
|
@ -219,7 +219,7 @@ __ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
|
||||||
* inode->i_mutex: down
|
* inode->i_mutex: down
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ext2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
ext2_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
|
@ -56,7 +56,7 @@ static inline int ext2_acl_count(size_t size)
|
||||||
|
|
||||||
/* acl.c */
|
/* acl.c */
|
||||||
extern struct posix_acl *ext2_get_acl(struct inode *inode, int type, bool rcu);
|
extern struct posix_acl *ext2_get_acl(struct inode *inode, int type, bool rcu);
|
||||||
extern int ext2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
extern int ext2_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
extern int ext2_init_acl (struct inode *, struct inode *);
|
extern int ext2_init_acl (struct inode *, struct inode *);
|
||||||
|
|
||||||
|
|
|
@ -1698,7 +1698,7 @@ int ext2_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
}
|
}
|
||||||
setattr_copy(&nop_mnt_idmap, inode, iattr);
|
setattr_copy(&nop_mnt_idmap, inode, iattr);
|
||||||
if (iattr->ia_valid & ATTR_MODE)
|
if (iattr->ia_valid & ATTR_MODE)
|
||||||
error = posix_acl_chmod(&init_user_ns, dentry, inode->i_mode);
|
error = posix_acl_chmod(&nop_mnt_idmap, dentry, inode->i_mode);
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
|
|
@ -225,9 +225,10 @@ __ext4_set_acl(handle_t *handle, struct inode *inode, int type,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ext4_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
ext4_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
|
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||||
handle_t *handle;
|
handle_t *handle;
|
||||||
int error, credits, retries = 0;
|
int error, credits, retries = 0;
|
||||||
size_t acl_size = acl ? ext4_acl_size(acl->a_count) : 0;
|
size_t acl_size = acl ? ext4_acl_size(acl->a_count) : 0;
|
||||||
|
|
|
@ -56,7 +56,7 @@ static inline int ext4_acl_count(size_t size)
|
||||||
|
|
||||||
/* acl.c */
|
/* acl.c */
|
||||||
struct posix_acl *ext4_get_acl(struct inode *inode, int type, bool rcu);
|
struct posix_acl *ext4_get_acl(struct inode *inode, int type, bool rcu);
|
||||||
int ext4_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int ext4_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
|
extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
|
||||||
|
|
||||||
|
|
|
@ -5675,7 +5675,7 @@ out_mmap_sem:
|
||||||
ext4_orphan_del(NULL, inode);
|
ext4_orphan_del(NULL, inode);
|
||||||
|
|
||||||
if (!error && (ia_valid & ATTR_MODE))
|
if (!error && (ia_valid & ATTR_MODE))
|
||||||
rc = posix_acl_chmod(mnt_userns, dentry, inode->i_mode);
|
rc = posix_acl_chmod(idmap, dentry, inode->i_mode);
|
||||||
|
|
||||||
err_out:
|
err_out:
|
||||||
if (error)
|
if (error)
|
||||||
|
|
|
@ -276,9 +276,10 @@ static int __f2fs_set_acl(struct user_namespace *mnt_userns,
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int f2fs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int f2fs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
|
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||||
struct inode *inode = d_inode(dentry);
|
struct inode *inode = d_inode(dentry);
|
||||||
|
|
||||||
if (unlikely(f2fs_cp_error(F2FS_I_SB(inode))))
|
if (unlikely(f2fs_cp_error(F2FS_I_SB(inode))))
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct f2fs_acl_header {
|
||||||
#ifdef CONFIG_F2FS_FS_POSIX_ACL
|
#ifdef CONFIG_F2FS_FS_POSIX_ACL
|
||||||
|
|
||||||
extern struct posix_acl *f2fs_get_acl(struct inode *, int, bool);
|
extern struct posix_acl *f2fs_get_acl(struct inode *, int, bool);
|
||||||
extern int f2fs_set_acl(struct user_namespace *, struct dentry *,
|
extern int f2fs_set_acl(struct mnt_idmap *, struct dentry *,
|
||||||
struct posix_acl *, int);
|
struct posix_acl *, int);
|
||||||
extern int f2fs_init_acl(struct inode *, struct inode *, struct page *,
|
extern int f2fs_init_acl(struct inode *, struct inode *, struct page *,
|
||||||
struct page *);
|
struct page *);
|
||||||
|
|
|
@ -960,7 +960,7 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
__setattr_copy(idmap, inode, attr);
|
__setattr_copy(idmap, inode, attr);
|
||||||
|
|
||||||
if (attr->ia_valid & ATTR_MODE) {
|
if (attr->ia_valid & ATTR_MODE) {
|
||||||
err = posix_acl_chmod(mnt_userns, dentry, f2fs_get_inode_mode(inode));
|
err = posix_acl_chmod(idmap, dentry, f2fs_get_inode_mode(inode));
|
||||||
|
|
||||||
if (is_inode_flag_set(inode, FI_ACL_MODE)) {
|
if (is_inode_flag_set(inode, FI_ACL_MODE)) {
|
||||||
if (!err)
|
if (!err)
|
||||||
|
|
|
@ -94,7 +94,7 @@ struct posix_acl *fuse_get_inode_acl(struct inode *inode, int type, bool rcu)
|
||||||
return __fuse_get_acl(fc, &nop_mnt_idmap, inode, type, rcu);
|
return __fuse_get_acl(fc, &nop_mnt_idmap, inode, type, rcu);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fuse_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int fuse_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
struct inode *inode = d_inode(dentry);
|
struct inode *inode = d_inode(dentry);
|
||||||
|
|
|
@ -1252,7 +1252,7 @@ struct posix_acl;
|
||||||
struct posix_acl *fuse_get_inode_acl(struct inode *inode, int type, bool rcu);
|
struct posix_acl *fuse_get_inode_acl(struct inode *inode, int type, bool rcu);
|
||||||
struct posix_acl *fuse_get_acl(struct mnt_idmap *idmap,
|
struct posix_acl *fuse_get_acl(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, int type);
|
struct dentry *dentry, int type);
|
||||||
int fuse_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int fuse_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
|
|
||||||
/* readdir.c */
|
/* readdir.c */
|
||||||
|
|
|
@ -109,7 +109,7 @@ out:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gfs2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int gfs2_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
struct inode *inode = d_inode(dentry);
|
struct inode *inode = d_inode(dentry);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
extern struct posix_acl *gfs2_get_acl(struct inode *inode, int type, bool rcu);
|
extern struct posix_acl *gfs2_get_acl(struct inode *inode, int type, bool rcu);
|
||||||
extern int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type);
|
extern int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type);
|
||||||
extern int gfs2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
extern int gfs2_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
|
|
||||||
#endif /* __ACL_DOT_H__ */
|
#endif /* __ACL_DOT_H__ */
|
||||||
|
|
|
@ -2016,7 +2016,7 @@ static int gfs2_setattr(struct mnt_idmap *idmap,
|
||||||
else {
|
else {
|
||||||
error = gfs2_setattr_simple(inode, attr);
|
error = gfs2_setattr_simple(inode, attr);
|
||||||
if (!error && attr->ia_valid & ATTR_MODE)
|
if (!error && attr->ia_valid & ATTR_MODE)
|
||||||
error = posix_acl_chmod(&init_user_ns, dentry,
|
error = posix_acl_chmod(&nop_mnt_idmap, dentry,
|
||||||
inode->i_mode);
|
inode->i_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ static int __jffs2_set_acl(struct inode *inode, int xprefix, struct posix_acl *a
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jffs2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int jffs2_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
int rc, xprefix;
|
int rc, xprefix;
|
||||||
|
|
|
@ -28,7 +28,7 @@ struct jffs2_acl_header {
|
||||||
#ifdef CONFIG_JFFS2_FS_POSIX_ACL
|
#ifdef CONFIG_JFFS2_FS_POSIX_ACL
|
||||||
|
|
||||||
struct posix_acl *jffs2_get_acl(struct inode *inode, int type, bool rcu);
|
struct posix_acl *jffs2_get_acl(struct inode *inode, int type, bool rcu);
|
||||||
int jffs2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int jffs2_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
extern int jffs2_init_acl_pre(struct inode *, struct inode *, umode_t *);
|
extern int jffs2_init_acl_pre(struct inode *, struct inode *, umode_t *);
|
||||||
extern int jffs2_init_acl_post(struct inode *);
|
extern int jffs2_init_acl_post(struct inode *);
|
||||||
|
|
|
@ -202,7 +202,7 @@ int jffs2_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
|
|
||||||
rc = jffs2_do_setattr(inode, iattr);
|
rc = jffs2_do_setattr(inode, iattr);
|
||||||
if (!rc && (iattr->ia_valid & ATTR_MODE))
|
if (!rc && (iattr->ia_valid & ATTR_MODE))
|
||||||
rc = posix_acl_chmod(&init_user_ns, dentry, inode->i_mode);
|
rc = posix_acl_chmod(&nop_mnt_idmap, dentry, inode->i_mode);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ out:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int jfs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
|
@ -123,7 +123,7 @@ int jfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
|
|
||||||
if (iattr->ia_valid & ATTR_MODE)
|
if (iattr->ia_valid & ATTR_MODE)
|
||||||
rc = posix_acl_chmod(&init_user_ns, dentry, inode->i_mode);
|
rc = posix_acl_chmod(&nop_mnt_idmap, dentry, inode->i_mode);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#ifdef CONFIG_JFS_POSIX_ACL
|
#ifdef CONFIG_JFS_POSIX_ACL
|
||||||
|
|
||||||
struct posix_acl *jfs_get_acl(struct inode *inode, int type, bool rcu);
|
struct posix_acl *jfs_get_acl(struct inode *inode, int type, bool rcu);
|
||||||
int jfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int jfs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
int jfs_init_acl(tid_t, struct inode *, struct inode *);
|
int jfs_init_acl(tid_t, struct inode *, struct inode *);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*/
|
*/
|
||||||
#ifdef CONFIG_NFS_V3_ACL
|
#ifdef CONFIG_NFS_V3_ACL
|
||||||
extern struct posix_acl *nfs3_get_acl(struct inode *inode, int type, bool rcu);
|
extern struct posix_acl *nfs3_get_acl(struct inode *inode, int type, bool rcu);
|
||||||
extern int nfs3_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
extern int nfs3_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
extern int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
|
extern int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
|
||||||
struct posix_acl *dfacl);
|
struct posix_acl *dfacl);
|
||||||
|
|
|
@ -254,7 +254,7 @@ int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int nfs3_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int nfs3_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
struct posix_acl *orig = acl, *dfacl = NULL, *alloc;
|
struct posix_acl *orig = acl, *dfacl = NULL, *alloc;
|
||||||
|
|
|
@ -113,11 +113,11 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp)
|
||||||
|
|
||||||
inode_lock(inode);
|
inode_lock(inode);
|
||||||
|
|
||||||
error = set_posix_acl(&init_user_ns, fh->fh_dentry, ACL_TYPE_ACCESS,
|
error = set_posix_acl(&nop_mnt_idmap, fh->fh_dentry, ACL_TYPE_ACCESS,
|
||||||
argp->acl_access);
|
argp->acl_access);
|
||||||
if (error)
|
if (error)
|
||||||
goto out_drop_lock;
|
goto out_drop_lock;
|
||||||
error = set_posix_acl(&init_user_ns, fh->fh_dentry, ACL_TYPE_DEFAULT,
|
error = set_posix_acl(&nop_mnt_idmap, fh->fh_dentry, ACL_TYPE_DEFAULT,
|
||||||
argp->acl_default);
|
argp->acl_default);
|
||||||
if (error)
|
if (error)
|
||||||
goto out_drop_lock;
|
goto out_drop_lock;
|
||||||
|
|
|
@ -103,11 +103,11 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp)
|
||||||
|
|
||||||
inode_lock(inode);
|
inode_lock(inode);
|
||||||
|
|
||||||
error = set_posix_acl(&init_user_ns, fh->fh_dentry, ACL_TYPE_ACCESS,
|
error = set_posix_acl(&nop_mnt_idmap, fh->fh_dentry, ACL_TYPE_ACCESS,
|
||||||
argp->acl_access);
|
argp->acl_access);
|
||||||
if (error)
|
if (error)
|
||||||
goto out_drop_lock;
|
goto out_drop_lock;
|
||||||
error = set_posix_acl(&init_user_ns, fh->fh_dentry, ACL_TYPE_DEFAULT,
|
error = set_posix_acl(&nop_mnt_idmap, fh->fh_dentry, ACL_TYPE_DEFAULT,
|
||||||
argp->acl_default);
|
argp->acl_default);
|
||||||
|
|
||||||
out_drop_lock:
|
out_drop_lock:
|
||||||
|
|
|
@ -575,12 +575,12 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||||
attr->na_labelerr = security_inode_setsecctx(dentry,
|
attr->na_labelerr = security_inode_setsecctx(dentry,
|
||||||
attr->na_seclabel->data, attr->na_seclabel->len);
|
attr->na_seclabel->data, attr->na_seclabel->len);
|
||||||
if (IS_ENABLED(CONFIG_FS_POSIX_ACL) && attr->na_pacl)
|
if (IS_ENABLED(CONFIG_FS_POSIX_ACL) && attr->na_pacl)
|
||||||
attr->na_aclerr = set_posix_acl(&init_user_ns,
|
attr->na_aclerr = set_posix_acl(&nop_mnt_idmap,
|
||||||
dentry, ACL_TYPE_ACCESS,
|
dentry, ACL_TYPE_ACCESS,
|
||||||
attr->na_pacl);
|
attr->na_pacl);
|
||||||
if (IS_ENABLED(CONFIG_FS_POSIX_ACL) &&
|
if (IS_ENABLED(CONFIG_FS_POSIX_ACL) &&
|
||||||
!attr->na_aclerr && attr->na_dpacl && S_ISDIR(inode->i_mode))
|
!attr->na_aclerr && attr->na_dpacl && S_ISDIR(inode->i_mode))
|
||||||
attr->na_aclerr = set_posix_acl(&init_user_ns,
|
attr->na_aclerr = set_posix_acl(&nop_mnt_idmap,
|
||||||
dentry, ACL_TYPE_DEFAULT,
|
dentry, ACL_TYPE_DEFAULT,
|
||||||
attr->na_dpacl);
|
attr->na_dpacl);
|
||||||
fh_fill_post_attrs(fhp);
|
fh_fill_post_attrs(fhp);
|
||||||
|
|
|
@ -260,7 +260,7 @@ static int ocfs2_set_acl(handle_t *handle,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ocfs2_iop_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int ocfs2_iop_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
struct buffer_head *bh = NULL;
|
struct buffer_head *bh = NULL;
|
||||||
|
|
|
@ -17,7 +17,7 @@ struct ocfs2_acl_entry {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type, bool rcu);
|
struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type, bool rcu);
|
||||||
int ocfs2_iop_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int ocfs2_iop_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
extern int ocfs2_acl_chmod(struct inode *, struct buffer_head *);
|
extern int ocfs2_acl_chmod(struct inode *, struct buffer_head *);
|
||||||
extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *,
|
extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *,
|
||||||
|
|
|
@ -118,7 +118,7 @@ out:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int orangefs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int orangefs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
|
@ -842,7 +842,7 @@ int __orangefs_setattr_mode(struct dentry *dentry, struct iattr *iattr)
|
||||||
ret = __orangefs_setattr(inode, iattr);
|
ret = __orangefs_setattr(inode, iattr);
|
||||||
/* change mode on a file that has ACLs */
|
/* change mode on a file that has ACLs */
|
||||||
if (!ret && (iattr->ia_valid & ATTR_MODE))
|
if (!ret && (iattr->ia_valid & ATTR_MODE))
|
||||||
ret = posix_acl_chmod(&init_user_ns, dentry, inode->i_mode);
|
ret = posix_acl_chmod(&nop_mnt_idmap, dentry, inode->i_mode);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ enum orangefs_vfs_op_states {
|
||||||
extern const struct xattr_handler *orangefs_xattr_handlers[];
|
extern const struct xattr_handler *orangefs_xattr_handlers[];
|
||||||
|
|
||||||
extern struct posix_acl *orangefs_get_acl(struct inode *inode, int type, bool rcu);
|
extern struct posix_acl *orangefs_get_acl(struct inode *inode, int type, bool rcu);
|
||||||
extern int orangefs_set_acl(struct user_namespace *mnt_userns,
|
extern int orangefs_set_acl(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, struct posix_acl *acl,
|
struct dentry *dentry, struct posix_acl *acl,
|
||||||
int type);
|
int type);
|
||||||
int __orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
|
int __orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
|
||||||
|
|
|
@ -539,7 +539,7 @@ out_drop_write:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ovl_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int ovl_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
|
@ -324,13 +324,13 @@ static inline int ovl_removexattr(struct ovl_fs *ofs, struct dentry *dentry,
|
||||||
static inline int ovl_do_set_acl(struct ovl_fs *ofs, struct dentry *dentry,
|
static inline int ovl_do_set_acl(struct ovl_fs *ofs, struct dentry *dentry,
|
||||||
const char *acl_name, struct posix_acl *acl)
|
const char *acl_name, struct posix_acl *acl)
|
||||||
{
|
{
|
||||||
return vfs_set_acl(ovl_upper_mnt_userns(ofs), dentry, acl_name, acl);
|
return vfs_set_acl(ovl_upper_mnt_idmap(ofs), dentry, acl_name, acl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int ovl_do_remove_acl(struct ovl_fs *ofs, struct dentry *dentry,
|
static inline int ovl_do_remove_acl(struct ovl_fs *ofs, struct dentry *dentry,
|
||||||
const char *acl_name)
|
const char *acl_name)
|
||||||
{
|
{
|
||||||
return vfs_remove_acl(ovl_upper_mnt_userns(ofs), dentry, acl_name);
|
return vfs_remove_acl(ovl_upper_mnt_idmap(ofs), dentry, acl_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int ovl_do_rename(struct ovl_fs *ofs, struct inode *olddir,
|
static inline int ovl_do_rename(struct ovl_fs *ofs, struct inode *olddir,
|
||||||
|
@ -689,7 +689,7 @@ static inline struct posix_acl *ovl_get_acl(struct mnt_idmap *idmap,
|
||||||
{
|
{
|
||||||
return do_ovl_get_acl(idmap, d_inode(dentry), type, false, false);
|
return do_ovl_get_acl(idmap, d_inode(dentry), type, false, false);
|
||||||
}
|
}
|
||||||
int ovl_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int ovl_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
struct posix_acl *ovl_get_acl_path(const struct path *path,
|
struct posix_acl *ovl_get_acl_path(const struct path *path,
|
||||||
const char *acl_name, bool noperm);
|
const char *acl_name, bool noperm);
|
||||||
|
|
|
@ -593,18 +593,18 @@ EXPORT_SYMBOL(__posix_acl_chmod);
|
||||||
/**
|
/**
|
||||||
* posix_acl_chmod - chmod a posix acl
|
* posix_acl_chmod - chmod a posix acl
|
||||||
*
|
*
|
||||||
* @mnt_userns: user namespace of the mount @inode was found from
|
* @idmap: idmap of the mount @inode was found from
|
||||||
* @dentry: dentry to check permissions on
|
* @dentry: dentry to check permissions on
|
||||||
* @mode: the new mode of @inode
|
* @mode: the new mode of @inode
|
||||||
*
|
*
|
||||||
* If the dentry has been found through an idmapped mount the user namespace of
|
* If the dentry has been found through an idmapped mount the idmap of
|
||||||
* the vfsmount must be passed through @mnt_userns. This function will then
|
* the vfsmount must be passed through @idmap. This function will then
|
||||||
* take care to map the inode according to @mnt_userns before checking
|
* take care to map the inode according to @idmap before checking
|
||||||
* permissions. On non-idmapped mounts or if permission checking is to be
|
* permissions. On non-idmapped mounts or if permission checking is to be
|
||||||
* performed on the raw inode simply passs init_user_ns.
|
* performed on the raw inode simply passs @nop_mnt_idmap.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
posix_acl_chmod(struct user_namespace *mnt_userns, struct dentry *dentry,
|
posix_acl_chmod(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
umode_t mode)
|
umode_t mode)
|
||||||
{
|
{
|
||||||
struct inode *inode = d_inode(dentry);
|
struct inode *inode = d_inode(dentry);
|
||||||
|
@ -626,7 +626,7 @@ int
|
||||||
ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode);
|
ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
ret = inode->i_op->set_acl(mnt_userns, dentry, acl, ACL_TYPE_ACCESS);
|
ret = inode->i_op->set_acl(idmap, dentry, acl, ACL_TYPE_ACCESS);
|
||||||
posix_acl_release(acl);
|
posix_acl_release(acl);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -936,7 +936,7 @@ static ssize_t vfs_posix_acl_to_xattr(struct mnt_idmap *idmap,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
set_posix_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
set_posix_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
int type, struct posix_acl *acl)
|
int type, struct posix_acl *acl)
|
||||||
{
|
{
|
||||||
struct inode *inode = d_inode(dentry);
|
struct inode *inode = d_inode(dentry);
|
||||||
|
@ -948,7 +948,7 @@ set_posix_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
||||||
|
|
||||||
if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode))
|
if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode))
|
||||||
return acl ? -EACCES : 0;
|
return acl ? -EACCES : 0;
|
||||||
if (!inode_owner_or_capable(mnt_userns, inode))
|
if (!inode_owner_or_capable(mnt_idmap_owner(idmap), inode))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
if (acl) {
|
if (acl) {
|
||||||
|
@ -956,7 +956,7 @@ set_posix_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return inode->i_op->set_acl(mnt_userns, dentry, acl, type);
|
return inode->i_op->set_acl(idmap, dentry, acl, type);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(set_posix_acl);
|
EXPORT_SYMBOL(set_posix_acl);
|
||||||
|
|
||||||
|
@ -1005,10 +1005,11 @@ const struct xattr_handler posix_acl_default_xattr_handler = {
|
||||||
};
|
};
|
||||||
EXPORT_SYMBOL_GPL(posix_acl_default_xattr_handler);
|
EXPORT_SYMBOL_GPL(posix_acl_default_xattr_handler);
|
||||||
|
|
||||||
int simple_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int simple_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||||
struct inode *inode = d_inode(dentry);
|
struct inode *inode = d_inode(dentry);
|
||||||
|
|
||||||
if (type == ACL_TYPE_ACCESS) {
|
if (type == ACL_TYPE_ACCESS) {
|
||||||
|
@ -1068,7 +1069,7 @@ static int vfs_set_acl_idmapped_mnt(struct user_namespace *mnt_userns,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vfs_set_acl - set posix acls
|
* vfs_set_acl - set posix acls
|
||||||
* @mnt_userns: user namespace of the mount
|
* @idmap: idmap of the mount
|
||||||
* @dentry: the dentry based on which to set the posix acls
|
* @dentry: the dentry based on which to set the posix acls
|
||||||
* @acl_name: the name of the posix acl
|
* @acl_name: the name of the posix acl
|
||||||
* @kacl: the posix acls in the appropriate VFS format
|
* @kacl: the posix acls in the appropriate VFS format
|
||||||
|
@ -1078,11 +1079,12 @@ static int vfs_set_acl_idmapped_mnt(struct user_namespace *mnt_userns,
|
||||||
*
|
*
|
||||||
* Return: On success 0, on error negative errno.
|
* Return: On success 0, on error negative errno.
|
||||||
*/
|
*/
|
||||||
int vfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int vfs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
const char *acl_name, struct posix_acl *kacl)
|
const char *acl_name, struct posix_acl *kacl)
|
||||||
{
|
{
|
||||||
int acl_type;
|
int acl_type;
|
||||||
int error;
|
int error;
|
||||||
|
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||||
struct inode *inode = d_inode(dentry);
|
struct inode *inode = d_inode(dentry);
|
||||||
struct inode *delegated_inode = NULL;
|
struct inode *delegated_inode = NULL;
|
||||||
|
|
||||||
|
@ -1123,7 +1125,7 @@ retry_deleg:
|
||||||
goto out_inode_unlock;
|
goto out_inode_unlock;
|
||||||
|
|
||||||
if (inode->i_opflags & IOP_XATTR)
|
if (inode->i_opflags & IOP_XATTR)
|
||||||
error = set_posix_acl(mnt_userns, dentry, acl_type, kacl);
|
error = set_posix_acl(idmap, dentry, acl_type, kacl);
|
||||||
else if (unlikely(is_bad_inode(inode)))
|
else if (unlikely(is_bad_inode(inode)))
|
||||||
error = -EIO;
|
error = -EIO;
|
||||||
else
|
else
|
||||||
|
@ -1194,7 +1196,7 @@ EXPORT_SYMBOL_GPL(vfs_get_acl);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vfs_remove_acl - remove posix acls
|
* vfs_remove_acl - remove posix acls
|
||||||
* @mnt_userns: user namespace of the mount
|
* @idmap: idmap of the mount
|
||||||
* @dentry: the dentry based on which to retrieve the posix acls
|
* @dentry: the dentry based on which to retrieve the posix acls
|
||||||
* @acl_name: the name of the posix acl
|
* @acl_name: the name of the posix acl
|
||||||
*
|
*
|
||||||
|
@ -1202,11 +1204,12 @@ EXPORT_SYMBOL_GPL(vfs_get_acl);
|
||||||
*
|
*
|
||||||
* Return: On success 0, on error negative errno.
|
* Return: On success 0, on error negative errno.
|
||||||
*/
|
*/
|
||||||
int vfs_remove_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int vfs_remove_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
const char *acl_name)
|
const char *acl_name)
|
||||||
{
|
{
|
||||||
int acl_type;
|
int acl_type;
|
||||||
int error;
|
int error;
|
||||||
|
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||||
struct inode *inode = d_inode(dentry);
|
struct inode *inode = d_inode(dentry);
|
||||||
struct inode *delegated_inode = NULL;
|
struct inode *delegated_inode = NULL;
|
||||||
|
|
||||||
|
@ -1234,7 +1237,7 @@ retry_deleg:
|
||||||
goto out_inode_unlock;
|
goto out_inode_unlock;
|
||||||
|
|
||||||
if (inode->i_opflags & IOP_XATTR)
|
if (inode->i_opflags & IOP_XATTR)
|
||||||
error = set_posix_acl(mnt_userns, dentry, acl_type, NULL);
|
error = set_posix_acl(idmap, dentry, acl_type, NULL);
|
||||||
else if (unlikely(is_bad_inode(inode)))
|
else if (unlikely(is_bad_inode(inode)))
|
||||||
error = -EIO;
|
error = -EIO;
|
||||||
else
|
else
|
||||||
|
@ -1273,7 +1276,7 @@ int do_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
return PTR_ERR(acl);
|
return PTR_ERR(acl);
|
||||||
}
|
}
|
||||||
|
|
||||||
error = vfs_set_acl(mnt_idmap_owner(idmap), dentry, acl_name, acl);
|
error = vfs_set_acl(idmap, dentry, acl_name, acl);
|
||||||
posix_acl_release(acl);
|
posix_acl_release(acl);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ static inline int reiserfs_acl_count(size_t size)
|
||||||
|
|
||||||
#ifdef CONFIG_REISERFS_FS_POSIX_ACL
|
#ifdef CONFIG_REISERFS_FS_POSIX_ACL
|
||||||
struct posix_acl *reiserfs_get_acl(struct inode *inode, int type, bool rcu);
|
struct posix_acl *reiserfs_get_acl(struct inode *inode, int type, bool rcu);
|
||||||
int reiserfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int reiserfs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
int reiserfs_acl_chmod(struct dentry *dentry);
|
int reiserfs_acl_chmod(struct dentry *dentry);
|
||||||
int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
|
int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
|
||||||
|
|
|
@ -18,7 +18,7 @@ static int __reiserfs_set_acl(struct reiserfs_transaction_handle *th,
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
reiserfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
reiserfs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
int error, error2;
|
int error, error2;
|
||||||
|
@ -407,5 +407,5 @@ int reiserfs_acl_chmod(struct dentry *dentry)
|
||||||
!reiserfs_posixacl(inode->i_sb))
|
!reiserfs_posixacl(inode->i_sb))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return posix_acl_chmod(&init_user_ns, dentry, inode->i_mode);
|
return posix_acl_chmod(&nop_mnt_idmap, dentry, inode->i_mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1740,7 +1740,7 @@ out:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int cifs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int cifs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_CIFS_ALLOW_INSECURE_LEGACY) && defined(CONFIG_CIFS_POSIX)
|
#if defined(CONFIG_CIFS_ALLOW_INSECURE_LEGACY) && defined(CONFIG_CIFS_POSIX)
|
||||||
|
|
|
@ -237,7 +237,7 @@ extern struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *,
|
||||||
const struct cifs_fid *, u32 *, u32);
|
const struct cifs_fid *, u32 *, u32);
|
||||||
extern struct posix_acl *cifs_get_acl(struct mnt_idmap *idmap,
|
extern struct posix_acl *cifs_get_acl(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, int type);
|
struct dentry *dentry, int type);
|
||||||
extern int cifs_set_acl(struct user_namespace *mnt_userns,
|
extern int cifs_set_acl(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, struct posix_acl *acl, int type);
|
struct dentry *dentry, struct posix_acl *acl, int type);
|
||||||
extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *,
|
extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *,
|
||||||
const char *, int);
|
const char *, int);
|
||||||
|
|
|
@ -890,7 +890,7 @@ removexattr(struct mnt_idmap *idmap, struct dentry *d,
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
if (is_posix_acl_xattr(kname))
|
if (is_posix_acl_xattr(kname))
|
||||||
return vfs_remove_acl(mnt_idmap_owner(idmap), d, kname);
|
return vfs_remove_acl(idmap, d, kname);
|
||||||
|
|
||||||
return vfs_removexattr(mnt_idmap_owner(idmap), d, kname);
|
return vfs_removexattr(mnt_idmap_owner(idmap), d, kname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,9 +242,10 @@ xfs_acl_set_mode(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
xfs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type)
|
struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
|
struct user_namespace *mnt_userns = mnt_idmap_owner(idmap);
|
||||||
umode_t mode;
|
umode_t mode;
|
||||||
bool set_mode = false;
|
bool set_mode = false;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
|
@ -11,7 +11,7 @@ struct posix_acl;
|
||||||
|
|
||||||
#ifdef CONFIG_XFS_POSIX_ACL
|
#ifdef CONFIG_XFS_POSIX_ACL
|
||||||
extern struct posix_acl *xfs_get_acl(struct inode *inode, int type, bool rcu);
|
extern struct posix_acl *xfs_get_acl(struct inode *inode, int type, bool rcu);
|
||||||
extern int xfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
extern int xfs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
struct posix_acl *acl, int type);
|
struct posix_acl *acl, int type);
|
||||||
extern int __xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
|
extern int __xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
|
||||||
void xfs_forget_acl(struct inode *inode, const char *name);
|
void xfs_forget_acl(struct inode *inode, const char *name);
|
||||||
|
|
|
@ -764,7 +764,7 @@ xfs_setattr_nonsize(
|
||||||
* Posix ACL code seems to care about this issue either.
|
* Posix ACL code seems to care about this issue either.
|
||||||
*/
|
*/
|
||||||
if (mask & ATTR_MODE) {
|
if (mask & ATTR_MODE) {
|
||||||
error = posix_acl_chmod(mnt_userns, dentry, inode->i_mode);
|
error = posix_acl_chmod(idmap, dentry, inode->i_mode);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2275,7 +2275,7 @@ struct inode_operations {
|
||||||
struct file *, umode_t);
|
struct file *, umode_t);
|
||||||
struct posix_acl *(*get_acl)(struct mnt_idmap *, struct dentry *,
|
struct posix_acl *(*get_acl)(struct mnt_idmap *, struct dentry *,
|
||||||
int);
|
int);
|
||||||
int (*set_acl)(struct user_namespace *, struct dentry *,
|
int (*set_acl)(struct mnt_idmap *, struct dentry *,
|
||||||
struct posix_acl *, int);
|
struct posix_acl *, int);
|
||||||
int (*fileattr_set)(struct user_namespace *mnt_userns,
|
int (*fileattr_set)(struct user_namespace *mnt_userns,
|
||||||
struct dentry *dentry, struct fileattr *fa);
|
struct dentry *dentry, struct fileattr *fa);
|
||||||
|
|
|
@ -69,20 +69,20 @@ extern int __posix_acl_create(struct posix_acl **, gfp_t, umode_t *);
|
||||||
extern int __posix_acl_chmod(struct posix_acl **, gfp_t, umode_t);
|
extern int __posix_acl_chmod(struct posix_acl **, gfp_t, umode_t);
|
||||||
|
|
||||||
extern struct posix_acl *get_posix_acl(struct inode *, int);
|
extern struct posix_acl *get_posix_acl(struct inode *, int);
|
||||||
int set_posix_acl(struct user_namespace *, struct dentry *, int,
|
int set_posix_acl(struct mnt_idmap *, struct dentry *, int,
|
||||||
struct posix_acl *);
|
struct posix_acl *);
|
||||||
|
|
||||||
struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type);
|
struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type);
|
||||||
struct posix_acl *posix_acl_clone(const struct posix_acl *acl, gfp_t flags);
|
struct posix_acl *posix_acl_clone(const struct posix_acl *acl, gfp_t flags);
|
||||||
|
|
||||||
#ifdef CONFIG_FS_POSIX_ACL
|
#ifdef CONFIG_FS_POSIX_ACL
|
||||||
int posix_acl_chmod(struct user_namespace *, struct dentry *, umode_t);
|
int posix_acl_chmod(struct mnt_idmap *, struct dentry *, umode_t);
|
||||||
extern int posix_acl_create(struct inode *, umode_t *, struct posix_acl **,
|
extern int posix_acl_create(struct inode *, umode_t *, struct posix_acl **,
|
||||||
struct posix_acl **);
|
struct posix_acl **);
|
||||||
int posix_acl_update_mode(struct user_namespace *, struct inode *, umode_t *,
|
int posix_acl_update_mode(struct user_namespace *, struct inode *, umode_t *,
|
||||||
struct posix_acl **);
|
struct posix_acl **);
|
||||||
|
|
||||||
int simple_set_acl(struct user_namespace *, struct dentry *,
|
int simple_set_acl(struct mnt_idmap *, struct dentry *,
|
||||||
struct posix_acl *, int);
|
struct posix_acl *, int);
|
||||||
extern int simple_acl_create(struct inode *, struct inode *);
|
extern int simple_acl_create(struct inode *, struct inode *);
|
||||||
|
|
||||||
|
@ -100,16 +100,16 @@ static inline void cache_no_acl(struct inode *inode)
|
||||||
inode->i_default_acl = NULL;
|
inode->i_default_acl = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int vfs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
const char *acl_name, struct posix_acl *kacl);
|
const char *acl_name, struct posix_acl *kacl);
|
||||||
struct posix_acl *vfs_get_acl(struct mnt_idmap *idmap,
|
struct posix_acl *vfs_get_acl(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, const char *acl_name);
|
struct dentry *dentry, const char *acl_name);
|
||||||
int vfs_remove_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
int vfs_remove_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||||
const char *acl_name);
|
const char *acl_name);
|
||||||
int posix_acl_listxattr(struct inode *inode, char **buffer,
|
int posix_acl_listxattr(struct inode *inode, char **buffer,
|
||||||
ssize_t *remaining_size);
|
ssize_t *remaining_size);
|
||||||
#else
|
#else
|
||||||
static inline int posix_acl_chmod(struct user_namespace *mnt_userns,
|
static inline int posix_acl_chmod(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -136,7 +136,7 @@ static inline void forget_all_cached_acls(struct inode *inode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int vfs_set_acl(struct user_namespace *mnt_userns,
|
static inline int vfs_set_acl(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *dentry, const char *name,
|
||||||
struct posix_acl *acl)
|
struct posix_acl *acl)
|
||||||
{
|
{
|
||||||
|
@ -150,7 +150,7 @@ static inline struct posix_acl *vfs_get_acl(struct mnt_idmap *idmap,
|
||||||
return ERR_PTR(-EOPNOTSUPP);
|
return ERR_PTR(-EOPNOTSUPP);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int vfs_remove_acl(struct user_namespace *mnt_userns,
|
static inline int vfs_remove_acl(struct mnt_idmap *idmap,
|
||||||
struct dentry *dentry, const char *acl_name)
|
struct dentry *dentry, const char *acl_name)
|
||||||
{
|
{
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
|
@ -1244,7 +1244,7 @@ static int shmem_setattr(struct mnt_idmap *idmap,
|
||||||
|
|
||||||
setattr_copy(idmap, inode, attr);
|
setattr_copy(idmap, inode, attr);
|
||||||
if (attr->ia_valid & ATTR_MODE)
|
if (attr->ia_valid & ATTR_MODE)
|
||||||
error = posix_acl_chmod(mnt_userns, dentry, inode->i_mode);
|
error = posix_acl_chmod(idmap, dentry, inode->i_mode);
|
||||||
if (!error && update_ctime) {
|
if (!error && update_ctime) {
|
||||||
inode->i_ctime = current_time(inode);
|
inode->i_ctime = current_time(inode);
|
||||||
if (update_mtime)
|
if (update_mtime)
|
||||||
|
|
Loading…
Reference in New Issue