From d8423388e07b16dc508ed453637879f47bebd1b1 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
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@microsoft.com>
---
fs/cifs/inode.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
@@ -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