diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-01 11:11:59 +0200 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2016-09-15 18:54:06 -0400 |
commit | cc318bc6819922ad17dbcbb5e0ac5164bcbb60d2 (patch) | |
tree | f7f34a2ab1422c8c50412cd1689202ad579ae12d /fs | |
parent | 0b764b2ea1ac39a0d41f49250c8b21b244710025 (diff) | |
download | lwn-cc318bc6819922ad17dbcbb5e0ac5164bcbb60d2.tar.gz lwn-cc318bc6819922ad17dbcbb5e0ac5164bcbb60d2.zip |
ovl: remove posix_acl_default from workdir
[ Upstream commit c11b9fdd6a612f376a5e886505f1c54c16d8c380 ]
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>
Cc: <stable@vger.kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/overlayfs/super.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index b2361a1b50f2..963dba388243 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -545,6 +545,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; @@ -560,6 +564,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 */ + 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); |