path: root/mm/memcontrol.c
diff options
authorChristian Brauner <>2021-01-21 14:19:22 +0100
committerChristian Brauner <>2021-01-24 14:27:16 +0100
commit02f92b3868a1b34ab98464e76b0e4e060474ba10 (patch)
tree355710b868f8a26f8fd5ba413938f92f8a24b68a /mm/memcontrol.c
parente6c9a71451560edba343cbcbd500bea0a188f0d1 (diff)
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: Cc: David Howells <> Cc: Al Viro <> Cc: Suggested-by: Christoph Hellwig <> Reviewed-by: Christoph Hellwig <> Reviewed-by: James Morris <> Signed-off-by: Christian Brauner <>
Diffstat (limited to 'mm/memcontrol.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 605f671203ef..cf9076f58582 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4899,7 +4899,7 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
/* the process need read permission on control file */
/* AV: shouldn't we check that it's been opened for read instead? */
- ret = inode_permission(file_inode(cfile.file), MAY_READ);
+ ret = file_permission(cfile.file, MAY_READ);
if (ret < 0)
goto out_put_cfile;