mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-28 16:53:49 +00:00
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:
parent
6485cf5ea2
commit
1cda52f1b4
@ -15,7 +15,6 @@ config FANOTIFY
|
||||
config FANOTIFY_ACCESS_PERMISSIONS
|
||||
bool "fanotify permissions checking"
|
||||
depends on FANOTIFY
|
||||
depends on SECURITY
|
||||
default n
|
||||
help
|
||||
Say Y here is you want fanotify listeners to be able to make permissions
|
||||
|
@ -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;
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kernel_read_file.h>
|
||||
#include <linux/lsm_hooks.h>
|
||||
#include <linux/fsnotify.h>
|
||||
#include <linux/mman.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/personality.h>
|
||||
@ -3104,13 +3103,7 @@ int security_file_receive(struct file *file)
|
||||
*/
|
||||
int security_file_open(struct file *file)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = call_int_hook(file_open, file);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return fsnotify_open_perm(file);
|
||||
return call_int_hook(file_open, file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user