summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-09-01 11:11:59 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-15 08:20:28 +0200
commit177b55a50dc37b13fe82596a09d77d407a26a2c2 (patch)
tree73f58410045204c587f46442bd87664d628ad2fe
parent5737dae59e53d19683d113bf16d7179dabed13bd (diff)
downloadlinux-stable-177b55a50dc37b13fe82596a09d77d407a26a2c2.tar.gz
linux-stable-177b55a50dc37b13fe82596a09d77d407a26a2c2.tar.bz2
linux-stable-177b55a50dc37b13fe82596a09d77d407a26a2c2.zip
ovl: remove posix_acl_default from workdir
commit c11b9fdd6a612f376a5e886505f1c54c16d8c380 upstream. 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: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/overlayfs/super.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 44841ef103a9..cd609f43ba65 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -798,6 +798,10 @@ retry:
struct kstat stat = {
.mode = S_IFDIR | 0,
};
+ struct iattr attr = {
+ .ia_valid = ATTR_MODE,
+ .ia_mode = stat.mode,
+ };
if (work->d_inode) {
err = -EEXIST;
@@ -813,6 +817,21 @@ retry:
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 */
+ inode_lock(work->d_inode);
+ err = notify_change(work, &attr, NULL);
+ inode_unlock(work->d_inode);
+ if (err)
+ goto out_dput;
}
out_unlock:
inode_unlock(dir);