]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
afs: Ignore AFS_ACE_READ and AFS_ACE_WRITE for directories
authorMarc Dionne <marc.dionne@auristor.com>
Thu, 6 Jul 2017 14:50:18 +0000 (15:50 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 9 Jul 2017 21:40:12 +0000 (14:40 -0700)
The AFS_ACE_READ and AFS_ACE_WRITE permission bits should not
be used to make access decisions for the directory itself.  They
are meant to control access for the objects contained in that
directory.

Reading a directory is allowed if the AFS_ACE_LOOKUP bit is set.
This would cause an incorrect access denied error for a directory
with AFS_ACE_LOOKUP but not AFS_ACE_READ.

The AFS_ACE_WRITE bit does not allow operations that modify the
directory.  For a directory with AFS_ACE_WRITE but neither
AFS_ACE_INSERT nor AFS_ACE_DELETE, this would result in trying
operations that would ultimately be denied by the server.

Signed-off-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/afs/security.c

index ecb86a6701801cb74745bc99b74f9d8a367a2792..faca66227ecfe626ad2009a81f3f0f353e3f3e08 100644 (file)
@@ -327,12 +327,11 @@ int afs_permission(struct inode *inode, int mask)
                        if (!(access & AFS_ACE_LOOKUP))
                                goto permission_denied;
                } else if (mask & MAY_READ) {
-                       if (!(access & AFS_ACE_READ))
+                       if (!(access & AFS_ACE_LOOKUP))
                                goto permission_denied;
                } else if (mask & MAY_WRITE) {
                        if (!(access & (AFS_ACE_DELETE | /* rmdir, unlink, rename from */
-                                       AFS_ACE_INSERT | /* create, mkdir, symlink, rename to */
-                                       AFS_ACE_WRITE))) /* chmod */
+                                       AFS_ACE_INSERT))) /* create, mkdir, symlink, rename to */
                                goto permission_denied;
                } else {
                        BUG();