[PATCH][WIP] do not ignore error on setinfo for chmod

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

 



We were incorrectly skipping errors in some cases in cifs_settattr_nounix


-- 
Thanks,

Steve
From d8423388e07b16dc508ed453637879f47bebd1b1 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@xxxxxxxxxxxxx>
Date: Thu, 1 Aug 2019 12:21:14 -0500
Subject: [PATCH] cifs: fix error handling on chmod

We were ignoring errors on chmod due to incorrect check of
which attributes were being changed (certain timestamp setting
errors can be safely ignored but not chmod).

Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
---
 fs/cifs/inode.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 26cdfbf1e164..25a5aeddc09a 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -2559,12 +2559,14 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
 		/* BB: check for rc = -EOPNOTSUPP and switch to legacy mode */
 
 		/* Even if error on time set, no sense failing the call if
-		the server would set the time to a reasonable value anyway,
-		and this check ensures that we are not being called from
-		sys_utimes in which case we ought to fail the call back to
-		the user when the server rejects the call */
-		if ((rc) && (attrs->ia_valid &
-				(ATTR_MODE | ATTR_GID | ATTR_UID | ATTR_SIZE)))
+		 * the server would set the time to a reasonable value anyway.
+		 * TODO check if check to ensure that are not being called from
+		 * sys_utimes (in which case we ought to fail the call when the
+		 * server rejects the call) is correct. We do want
+	         * to return an rc if error setting mode or owner or size
+		 */
+		if (rc && ((attrs->ia_valid &
+		      (ATTR_MODE | ATTR_GID | ATTR_UID | ATTR_SIZE)) == 0))
 			rc = 0;
 	}
 
-- 
2.20.1


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux