aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/notify/fanotify/fanotify_user.c9
-rw-r--r--include/linux/fanotify.h4
2 files changed, 11 insertions, 2 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 1d33d7db277..f9216102b42 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -707,7 +707,14 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
707 group->max_events = FANOTIFY_DEFAULT_MAX_EVENTS; 707 group->max_events = FANOTIFY_DEFAULT_MAX_EVENTS;
708 } 708 }
709 709
710 group->fanotify_data.max_marks = FANOTIFY_DEFAULT_MAX_MARKS; 710 if (flags & FAN_UNLIMITED_MARKS) {
711 fd = -EPERM;
712 if (!capable(CAP_SYS_ADMIN))
713 goto out_put_group;
714 group->fanotify_data.max_marks = UINT_MAX;
715 } else {
716 group->fanotify_data.max_marks = FANOTIFY_DEFAULT_MAX_MARKS;
717 }
711 718
712 fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags); 719 fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags);
713 if (fd < 0) 720 if (fd < 0)
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index e37f559c95e..7592a366a57 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -32,9 +32,11 @@
32 FAN_CLASS_PRE_CONTENT) 32 FAN_CLASS_PRE_CONTENT)
33 33
34#define FAN_UNLIMITED_QUEUE 0x00000010 34#define FAN_UNLIMITED_QUEUE 0x00000010
35#define FAN_UNLIMITED_MARKS 0x00000020
35 36
36#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \ 37#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \
37 FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE) 38 FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\
39 FAN_UNLIMITED_MARKS)
38 40
39/* flags used for fanotify_modify_mark() */ 41/* flags used for fanotify_modify_mark() */
40#define FAN_MARK_ADD 0x00000001 42#define FAN_MARK_ADD 0x00000001