Commit 02b7c975 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Sasha Levin

ovl: remove posix_acl_default from workdir

[ Upstream commit c11b9fdd ]

Clear out posix acl xattrs on workdir and also reset the mode after
creation so that an inherited sgid bit is cleared.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 29c4d8db
......@@ -658,6 +658,10 @@ static struct dentry *ovl_workdir_create(struct vfsmount *mnt,
struct kstat stat = {
.mode = S_IFDIR | 0,
};
struct iattr attr = {
.ia_valid = ATTR_MODE,
.ia_mode = stat.mode,
};
if (work->d_inode) {
err = -EEXIST;
......@@ -673,6 +677,21 @@ static struct dentry *ovl_workdir_create(struct vfsmount *mnt,
err = ovl_create_real(dir, work, &stat, NULL, NULL, true);
if (err)
goto out_dput;
err = vfs_removexattr(work, XATTR_NAME_POSIX_ACL_DEFAULT);
if (err && err != -ENODATA)
goto out_dput;
err = vfs_removexattr(work, XATTR_NAME_POSIX_ACL_ACCESS);
if (err && err != -ENODATA)
goto out_dput;
/* Clear any inherited mode bits */
mutex_lock(&work->d_inode->i_mutex);
err = notify_change(work, &attr, NULL);
mutex_unlock(&work->d_inode->i_mutex);
if (err)
goto out_dput;
}
out_unlock:
mutex_unlock(&dir->i_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment