Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1587654

[PATCH 04/14] afs: Adjust mode bits processing

From David Howells <dhowells@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 04/14] afs: Adjust mode bits processing
Date 2017-02-24 14:30 +0100
Message-ID <teo6B-J9-7@gated-at.bofh.it> (permalink)
References <tenWV-FB-21@gated-at.bofh.it>
Organization Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903

Show all headers | View raw


From: Marc Dionne <marc.dionne@auristor.com>

Mode bits for an afs file should not be enforced in the usual
way.

For files, the absence of user bits can restrict file access
with respect to what is granted by the server.

These bits apply regardless of the owner or the current uid; the
rest of the mode bits (group, other) are ignored.

Signed-off-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/afs/security.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/afs/security.c b/fs/afs/security.c
index 8d010422dc89..bfa9d3428383 100644
--- a/fs/afs/security.c
+++ b/fs/afs/security.c
@@ -340,17 +340,22 @@ int afs_permission(struct inode *inode, int mask)
 	} else {
 		if (!(access & AFS_ACE_LOOKUP))
 			goto permission_denied;
+		if ((mask & MAY_EXEC) && !(inode->i_mode & S_IXUSR))
+			goto permission_denied;
 		if (mask & (MAY_EXEC | MAY_READ)) {
 			if (!(access & AFS_ACE_READ))
 				goto permission_denied;
+			if (!(inode->i_mode & S_IRUSR))
+				goto permission_denied;
 		} else if (mask & MAY_WRITE) {
 			if (!(access & AFS_ACE_WRITE))
 				goto permission_denied;
+			if (!(inode->i_mode & S_IWUSR))
+				goto permission_denied;
 		}
 	}
 
 	key_put(key);
-	ret = generic_permission(inode, mask);
 	_leave(" = %d", ret);
 	return ret;
 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/14] AFS: Fixes and cleanups David Howells <dhowells@redhat.com> - 2017-02-24 14:20 +0100
  [PATCH 11/14] afs: inode: Replace rcu_assign_pointer() with  RCU_INIT_POINTER() David Howells <dhowells@redhat.com> - 2017-02-24 14:20 +0100
  [PATCH 08/14] afs: Handle a short write to an AFS page David Howells <dhowells@redhat.com> - 2017-02-24 14:30 +0100
  [PATCH 04/14] afs: Adjust mode bits processing David Howells <dhowells@redhat.com> - 2017-02-24 14:30 +0100
  [PATCH 02/14] afs: Fix page overput in afs_fill_page() David Howells <dhowells@redhat.com> - 2017-02-24 14:30 +0100
  [PATCH 09/14] afs: Flush outstanding writes when an fd is closed David Howells <dhowells@redhat.com> - 2017-02-24 14:30 +0100
  [PATCH 14/14] afs: Prevent callback expiry timer overflow David Howells <dhowells@redhat.com> - 2017-02-24 14:30 +0100
  [PATCH 03/14] afs: Populate group ID from vnode status David Howells <dhowells@redhat.com> - 2017-02-24 14:30 +0100

csiph-web