]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
UBUNTU: SAUCE: shiftfs: use translated ids when chaning lower fs attrs
authorSeth Forshee <seth.forshee@canonical.com>
Thu, 11 Apr 2019 12:31:04 +0000 (07:31 -0500)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 15 Feb 2021 07:25:43 +0000 (08:25 +0100)
BugLink: https://bugs.launchpad.net/bugs/1824350
shiftfs_setattr() is preparing a new set of attributes with the
owner translated for the lower fs, but it then passes the
original attrs. As a result the owner is set to the untranslated
owner, which causes the shiftfs inodes to also have incorrect
ids. For example:

 # mkdir dir
 # touch file
 # ls -lh dir file
 drwxr-xr-x 2 root root 4.0K Apr 11 13:05 dir
 -rw-r--r-- 1 root root 0 Apr 11 13:05 file
 # chown 500:500 dir file
 # ls -lh dir file
 drwxr-xr-x 2 1000500 1000500 4.0K Apr 11 12:42 dir
 -rw-r--r-- 1 1000500 1000500 0 Apr 11 12:42 file

Fix this to pass the correct iattr struct to notify_change().

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/shiftfs.c

index 678cad30f4a57aa25945a4fae1c27665145bb607..e736fd6afcb49e28f9f78d66c651146ae359b6bb 100644 (file)
@@ -779,7 +779,7 @@ static int shiftfs_setattr(struct dentry *dentry, struct iattr *attr)
 
        inode_lock(loweri);
        oldcred = shiftfs_override_creds(dentry->d_sb);
-       err = notify_change(lowerd, attr, NULL);
+       err = notify_change(lowerd, &newattr, NULL);
        revert_creds(oldcred);
        inode_unlock(loweri);