fsnotify, lsm: Decouple fsnotify from lsm

Currently, fsnotify_open_perm() is called from security_file_open().
This is a a bit unexpected and creates otherwise unnecessary dependency
of CONFIG_FANOTIFY_ACCESS_PERMISSIONS on CONFIG_SECURITY. Fix this by
calling fsnotify_open_perm() directly.

Signed-off-by: Song Liu <song@kernel.org>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20241013002248.3984442-1-song@kernel.org
This commit is contained in:
Song Liu
2024-10-12 17:22:48 -07:00
committed by Jan Kara
parent 6485cf5ea2
commit 1cda52f1b4
3 changed files with 5 additions and 9 deletions

View File

@@ -946,6 +946,10 @@ static int do_dentry_open(struct file *f,
if (error)
goto cleanup_all;
error = fsnotify_open_perm(f);
if (error)
goto cleanup_all;
error = break_lease(file_inode(f), f->f_flags);
if (error)
goto cleanup_all;