Message ID | 1457731394-67110-1-git-send-email-seth.forshee@canonical.com |
---|---|
State | New |
Headers | show |
On Fri, Mar 11, 2016 at 03:23:14PM -0600, Seth Forshee wrote: > From: Konstantin Khlebnikov <koct9i@gmail.com> > > 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> Note that this should also come to us via upstream stable. If it will make it into the next release via stable updates that's fine, I just want to make sure we get it one way or the other in our next kernel updates.
Applied to Xenial
Applied to the master-next branch of Wily.
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index b29036a..05ac9a9 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -65,6 +65,8 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr) 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);