diff options
author | Amir Goldstein <amir73il@gmail.com> | 2023-12-12 11:44:40 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2023-12-12 16:20:02 +0100 |
commit | d9e5d31084b024734e64307521414ef0ae1d5333 (patch) | |
tree | 5cad647473aa9eba5963c8d8caa7cf7dac635200 /include/linux/fsnotify.h | |
parent | cb383f06686734ef04daf63a4369566800717b7b (diff) | |
download | linux-d9e5d31084b024734e64307521414ef0ae1d5333.tar.gz linux-d9e5d31084b024734e64307521414ef0ae1d5333.tar.bz2 linux-d9e5d31084b024734e64307521414ef0ae1d5333.zip |
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 'include/linux/fsnotify.h')
-rw-r--r-- | include/linux/fsnotify.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 0a9d6a8a747a..11e6434b8e71 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -101,9 +101,10 @@ static inline int fsnotify_file(struct file *file, __u32 mask) } /* - * fsnotify_file_perm - permission hook before file access + * fsnotify_file_area_perm - permission hook before access to file range */ -static inline int fsnotify_file_perm(struct file *file, int perm_mask) +static inline int fsnotify_file_area_perm(struct file *file, int perm_mask, + const loff_t *ppos, size_t count) { __u32 fsnotify_mask = FS_ACCESS_PERM; @@ -121,6 +122,14 @@ static inline int fsnotify_file_perm(struct file *file, int perm_mask) } /* + * fsnotify_file_perm - permission hook before file access + */ +static inline int fsnotify_file_perm(struct file *file, int perm_mask) +{ + return fsnotify_file_area_perm(file, perm_mask, NULL, 0); +} + +/* * fsnotify_open_perm - permission hook before file open */ static inline int fsnotify_open_perm(struct file *file) |