summaryrefslogtreecommitdiff
path: root/fs/open.c
diff options
context:
space:
mode:
authorSong Liu <song@kernel.org>2024-10-12 17:22:48 -0700
committerJan Kara <jack@suse.cz>2024-10-14 17:38:27 +0200
commit1cda52f1b4611f4daa9d89e69d9428fb4137dc3f (patch)
treef852c5ac8fefb8da87e20fd155c23a76e7ec68e2 /fs/open.c
parent6485cf5ea253d40d507cd71253c9568c5470cd27 (diff)
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
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/open.c b/fs/open.c
index acaeb3e25c88..6c4950f19cfb 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -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;