Linux-CIFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH][WIP] do not ignore error on setinfo for chmod
@ 2019-08-01 18:05 Steve French
  0 siblings, 0 replies; only message in thread
From: Steve French @ 2019-08-01 18:05 UTC (permalink / raw)
  To: CIFS

[-- Attachment #1: Type: text/plain, Size: 95 bytes --]

We were incorrectly skipping errors in some cases in cifs_settattr_nounix


-- 
Thanks,

Steve

[-- Attachment #2: 0001-cifs-fix-error-handling-on-chmod.patch --]
[-- Type: text/x-patch, Size: 1642 bytes --]

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(-)

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-01 18:05 [PATCH][WIP] do not ignore error on setinfo for chmod Steve French

Linux-CIFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-cifs/0 linux-cifs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-cifs linux-cifs/ https://lore.kernel.org/linux-cifs \
		linux-cifs@vger.kernel.org linux-cifs@archiver.kernel.org
	public-inbox-index linux-cifs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-cifs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox