lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 24 Feb 2020 19:08:42 +0800
From:   Robert Yang <liezhi.yang@...driver.com>
To:     <tytso@....edu>
CC:     <linux-ext4@...r.kernel.org>
Subject: [PATCH][e2fsprogs] misc/create_inode.c: set dir's mode correctly

The dir's mode has been set by ext2fs_mkdir() with umask, so
reset it to the source's mode in set_inode_extra().

Fixed when source dir's mode is 521, but dst dir's mode is 721 which was
incorrect.

Signed-off-by: Robert Yang <liezhi.yang@...driver.com>
---
 misc/create_inode.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/misc/create_inode.c b/misc/create_inode.c
index 5161d5e..f82f74e 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -124,7 +124,14 @@ static errcode_t set_inode_extra(ext2_filsys fs, ext2_ino_t ino,
 	ext2fs_set_i_uid_high(inode, st->st_uid >> 16);
 	inode.i_gid = st->st_gid;
 	ext2fs_set_i_gid_high(inode, st->st_gid >> 16);
-	inode.i_mode |= st->st_mode;
+	/*
+	 * The dir's mode has been set by ext2fs_mkdir() with umask, so
+	 * reset it to the source's mode
+	 */
+	if S_ISDIR(st->st_mode)
+		inode.i_mode = LINUX_S_IFDIR | st->st_mode;
+	else
+		inode.i_mode |= st->st_mode;
 	inode.i_atime = st->st_atime;
 	inode.i_mtime = st->st_mtime;
 	inode.i_ctime = st->st_ctime;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ