[PATCH] fs: only pass valid chmod mode_t bits to security_path_chmod

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



chmod only pays attention to some of the flags in umode_t, don't pass
on irrelevant flags to security_path_chmod.

Signed-off-by: daurnimator <quae@xxxxxxxxxxxxxxx>
---
 fs/open.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/open.c b/fs/open.c
index b69d6eed67e6..a2d8bee88a3c 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -551,12 +551,13 @@ static int chmod_common(const struct path *path, umode_t mode)
 	error = mnt_want_write(path->mnt);
 	if (error)
 		return error;
+	mode &= S_IALLUGO;
 retry_deleg:
 	inode_lock(inode);
 	error = security_path_chmod(path, mode);
 	if (error)
 		goto out_unlock;
-	newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
+	newattrs.ia_mode = mode | (inode->i_mode & ~S_IALLUGO);
 	newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
 	error = notify_change(path->dentry, &newattrs, &delegated_inode);
 out_unlock:
-- 
2.26.0




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux