Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc318bc6 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Sasha Levin
Browse files

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: default avatarMiklos Szeredi <mszeredi@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 0b764b2e
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -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);