mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
fs: add file and path permissions helpers
Add two simple helpers to check permissions on a file and path respectively and convert over some callers. It simplifies quite a few codepaths and also reduces the churn in later patches quite a bit. Christoph also correctly points out that this makes codepaths (e.g. ioctls) way easier to follow that would otherwise have to do more complex argument passing than necessary. Link: https://lore.kernel.org/r/20210121131959.646623-4-christian.brauner@ubuntu.com Cc: David Howells <dhowells@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Suggested-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: James Morris <jamorris@linux.microsoft.com> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
@@ -167,7 +167,7 @@ static inline bool can_do_mincore(struct vm_area_struct *vma)
|
||||
* mappings, which opens a side channel.
|
||||
*/
|
||||
return inode_owner_or_capable(file_inode(vma->vm_file)) ||
|
||||
inode_permission(file_inode(vma->vm_file), MAY_WRITE) == 0;
|
||||
file_permission(vma->vm_file, MAY_WRITE) == 0;
|
||||
}
|
||||
|
||||
static const struct mm_walk_ops mincore_walk_ops = {
|
||||
|
||||
Reference in New Issue
Block a user