summaryrefslogtreecommitdiff
path: root/fs/readdir.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2023-12-12 12:44:40 +0300
committerChristian Brauner <brauner@kernel.org>2023-12-12 18:20:02 +0300
commitd9e5d31084b024734e64307521414ef0ae1d5333 (patch)
tree5cad647473aa9eba5963c8d8caa7cf7dac635200 /fs/readdir.c
parentcb383f06686734ef04daf63a4369566800717b7b (diff)
downloadlinux-d9e5d31084b024734e64307521414ef0ae1d5333.tar.xz
fsnotify: optionally pass access range in file permission hooks
In preparation for pre-content permission events with file access range, move fsnotify_file_perm() hook out of security_file_permission() and into the callers. Callers that have the access range information call the new hook fsnotify_file_area_perm() with the access range. Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Link: https://lore.kernel.org/r/20231212094440.250945-6-amir73il@gmail.com Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/readdir.c')
-rw-r--r--fs/readdir.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/readdir.c b/fs/readdir.c
index c8c46e294431..278bc0254732 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -96,6 +96,10 @@ int iterate_dir(struct file *file, struct dir_context *ctx)
if (res)
goto out;
+ res = fsnotify_file_perm(file, MAY_READ);
+ if (res)
+ goto out;
+
res = down_read_killable(&inode->i_rwsem);
if (res)
goto out;