]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ovl: copy new uid/gid into overlayfs runtime inode
authorKonstantin Khlebnikov <koct9i@gmail.com>
Sun, 31 Jan 2016 13:21:29 +0000 (16:21 +0300)
committerMiklos Szeredi <miklos@szeredi.hu>
Thu, 3 Mar 2016 16:17:46 +0000 (17:17 +0100)
Overlayfs must update uid/gid after chown, otherwise functions
like inode_owner_or_capable() will check user against stale uid.
Catched by xfstests generic/087, it chowns file and calls utimes.

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Cc: <stable@vger.kernel.org>
fs/overlayfs/inode.c

index 49e204560655a8f1737a2a03a38b7a88604a5a4c..a4ff5d0d7db91605880b4eb350ea37aa397c9c9d 100644 (file)
@@ -65,6 +65,8 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr)
 
                inode_lock(upperdentry->d_inode);
                err = notify_change(upperdentry, attr, NULL);
+               if (!err)
+                       ovl_copyattr(upperdentry->d_inode, dentry->d_inode);
                inode_unlock(upperdentry->d_inode);
        }
        ovl_drop_write(dentry);