Skip to content

Commit 627f469

Browse files
Marc Dionnedhowells
authored andcommitted
afs: Adjust mode bits processing
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>
1 parent 6186f07 commit 627f469

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎fs/afs/security.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,17 +340,22 @@ int afs_permission(struct inode *inode, int mask)
340340
} else {
341341
if (!(access & AFS_ACE_LOOKUP))
342342
goto permission_denied;
343+
if ((mask & MAY_EXEC) && !(inode->i_mode & S_IXUSR))
344+
goto permission_denied;
343345
if (mask & (MAY_EXEC | MAY_READ)) {
344346
if (!(access & AFS_ACE_READ))
345347
goto permission_denied;
348+
if (!(inode->i_mode & S_IRUSR))
349+
goto permission_denied;
346350
} else if (mask & MAY_WRITE) {
347351
if (!(access & AFS_ACE_WRITE))
348352
goto permission_denied;
353+
if (!(inode->i_mode & S_IWUSR))
354+
goto permission_denied;
349355
}
350356
}
351357

352358
key_put(key);
353-
ret = generic_permission(inode, mask);
354359
_leave(" = %d", ret);
355360
return ret;
356361

0 commit comments

Comments
 (0)