]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - fs/open.c
fs: port vfs{g,u}id helpers to mnt_idmap
[thirdparty/linux.git] / fs / open.c
index e9e5da4815a9c08b1342112582258cf3f10ee04e..f9d48da3c6308474505c641dd14ff413a12d0109 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -702,7 +702,7 @@ static inline bool setattr_vfsgid(struct iattr *attr, kgid_t kgid)
 int chown_common(const struct path *path, uid_t user, gid_t group)
 {
        struct mnt_idmap *idmap;
-       struct user_namespace *mnt_userns, *fs_userns;
+       struct user_namespace *fs_userns;
        struct inode *inode = path->dentry->d_inode;
        struct inode *delegated_inode = NULL;
        int error;
@@ -714,7 +714,6 @@ int chown_common(const struct path *path, uid_t user, gid_t group)
        gid = make_kgid(current_user_ns(), group);
 
        idmap = mnt_idmap(path->mnt);
-       mnt_userns = mnt_idmap_owner(idmap);
        fs_userns = i_user_ns(inode);
 
 retry_deleg:
@@ -732,8 +731,8 @@ retry_deleg:
        /* Continue to send actual fs values, not the mount values. */
        error = security_path_chown(
                path,
-               from_vfsuid(mnt_userns, fs_userns, newattrs.ia_vfsuid),
-               from_vfsgid(mnt_userns, fs_userns, newattrs.ia_vfsgid));
+               from_vfsuid(idmap, fs_userns, newattrs.ia_vfsuid),
+               from_vfsgid(idmap, fs_userns, newattrs.ia_vfsgid));
        if (!error)
                error = notify_change(idmap, path->dentry, &newattrs,
                                      &delegated_inode);