]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fs: move permission hook out of do_iter_write()
authorAmir Goldstein <amir73il@gmail.com>
Sun, 16 Jul 2023 11:47:14 +0000 (14:47 +0300)
committerChristian Brauner <brauner@kernel.org>
Fri, 24 Nov 2023 09:37:44 +0000 (10:37 +0100)
commit1c8aa833034a00617866ea4738a40491e3e23902
tree94471c01ab560aba5e832a1ebfb6c4e884be6493
parent269aed7014b3db9acdbc5a5e163d8a6c62e0e770
fs: move permission hook out of do_iter_write()

In many of the vfs helpers, the rw_verity_area() checks are called before
taking sb_start_write(), making them "start-write-safe".
do_iter_write() is an exception to this rule.

do_iter_write() has two callers - vfs_iter_write() and vfs_writev().
Move rw_verify_area() and other checks from do_iter_write() out to
its callers to make them "start-write-safe".

Move also the fsnotify_modify() hook to align with similar pattern
used in vfs_write() and other vfs helpers.

This is needed for fanotify "pre content" events.

Suggested-by: Jan Kara <jack@suse.cz>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://lore.kernel.org/r/20231122122715.2561213-12-amir73il@gmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/read_write.c