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:53:30 -0400 |
commit | 02b7c975b7730d37e8727880c1bf6c83d7bfa5c3 (patch) | |
tree | 40cafd3a96a67bb8146ab5b7b66f5dd5a1f73140 /fs | |
parent | 29c4d8dbfc793c9876db5c4193686ba6ffcb3cd6 (diff) | |
download | linux-exynos-02b7c975b7730d37e8727880c1bf6c83d7bfa5c3.tar.gz linux-exynos-02b7c975b7730d37e8727880c1bf6c83d7bfa5c3.tar.bz2 linux-exynos-02b7c975b7730d37e8727880c1bf6c83d7bfa5c3.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 39266655d2bd..c9b740111526 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -658,6 +658,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; @@ -673,6 +677,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); |