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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <71c6964a-bcab-0c53-931a-6e41b2637ff0@paragon-software.com>
Date:   Fri, 24 Jun 2022 14:40:54 +0300
From:   Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
To:     <ntfs3@...ts.linux.dev>
CC:     <linux-kernel@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>
Subject: [PATCH 1/3] fs/ntfs3: Do not change mode if ntfs_set_ea failed

ntfs_set_ea can fail with NOSPC, so we don't need to
change mode in this situation.
Fixes xfstest generic/449
Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations")

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
---
  fs/ntfs3/xattr.c | 20 ++++++++++----------
  1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
index 5e0e0280e70d..1e849428bbc8 100644
--- a/fs/ntfs3/xattr.c
+++ b/fs/ntfs3/xattr.c
@@ -547,28 +547,23 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
  {
  	const char *name;
  	size_t size, name_len;
-	void *value = NULL;
-	int err = 0;
+	void *value;
+	int err;
  	int flags;
+	umode_t mode;
  
  	if (S_ISLNK(inode->i_mode))
  		return -EOPNOTSUPP;
  
+	mode = inode->i_mode;
  	switch (type) {
  	case ACL_TYPE_ACCESS:
  		/* Do not change i_mode if we are in init_acl */
  		if (acl && !init_acl) {
-			umode_t mode;
-
  			err = posix_acl_update_mode(mnt_userns, inode, &mode,
  						    &acl);
  			if (err)
  				goto out;
-
-			if (inode->i_mode != mode) {
-				inode->i_mode = mode;
-				mark_inode_dirty(inode);
-			}
  		}
  		name = XATTR_NAME_POSIX_ACL_ACCESS;
  		name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
@@ -604,8 +599,13 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
  	err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);
  	if (err == -ENODATA && !size)
  		err = 0; /* Removing non existed xattr. */
-	if (!err)
+	if (!err) {
  		set_cached_acl(inode, type, acl);
+		if (inode->i_mode != mode) {
+			inode->i_mode = mode;
+			mark_inode_dirty(inode);
+		}
+	}
  
  out:
  	kfree(value);
-- 
2.36.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ