summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <koct9i@gmail.com>2016-01-31 16:21:29 +0300
committerSasha Levin <sasha.levin@oracle.com>2016-03-22 11:10:27 -0400
commit546a8b3c4059af5fd8466f3d1848321e7613904c (patch)
tree4c446ac084a0c6c2f614b270e853e8c9bfe41d8c
parent091baa9c784fe57b8778a4b754931ffe57245db3 (diff)
downloadlwn-546a8b3c4059af5fd8466f3d1848321e7613904c.tar.gz
lwn-546a8b3c4059af5fd8466f3d1848321e7613904c.zip
ovl: copy new uid/gid into overlayfs runtime inode
[ Upstream commit b81de061fa59f17d2730aabb1b84419ef3913810 ] 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> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r--fs/overlayfs/inode.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index a1b069e5e363..e505b44a9184 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -66,6 +66,8 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr)
if (upperdentry) {
mutex_lock(&upperdentry->d_inode->i_mutex);
err = notify_change(upperdentry, attr, NULL);
+ if (!err)
+ ovl_copyattr(upperdentry->d_inode, dentry->d_inode);
mutex_unlock(&upperdentry->d_inode->i_mutex);
} else {
err = ovl_copy_up_last(dentry, attr, false);