Skip to contentSkip to conversation

ovl: copy new uid/gid into overlayfs runtime inode

PATCH New Miklos Szeredi 1 participant 1 message Mar 12, 2016

Subsystems (2)
lore
Share & tools
lore

Miklos Szeredi

author maintainer
#0 lore raw

PATCH 1/1 ovl: copy new uid/gid into overlayfs runtime inode

From: Konstantin Khlebnikov <[email protected]>
Date: Sun, 31 Jan 2016 16:21:29 +0300

commit b81de061fa59f17d2730aabb1b84419ef3913810 upstream.

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.

---
 fs/overlayfs/inode.c |    2 ++
 1 file changed, 2 insertions(+)
fs/overlayfs/inode.c +2 -0
@@ -52,6 +52,8 @@ int ovl_setattr(struct dentry *dentry, s
 
 		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);
 	}
 	ovl_drop_write(dentry);