aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/notify/fanotify/fanotify_user.c9
-rw-r--r--include/linux/fanotify.h5
2 files changed, 11 insertions, 3 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 04f2fe47b66a..43d66d9b2eff 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -691,7 +691,14 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
691 goto out_put_group; 691 goto out_put_group;
692 } 692 }
693 693
694 group->max_events = FANOTIFY_DEFAULT_MAX_EVENTS; 694 if (flags & FAN_UNLIMITED_QUEUE) {
695 fd = -EPERM;
696 if (!capable(CAP_SYS_ADMIN))
697 goto out_put_group;
698 group->max_events = UINT_MAX;
699 } else {
700 group->max_events = FANOTIFY_DEFAULT_MAX_EVENTS;
701 }
695 702
696 fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags); 703 fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags);
697 if (fd < 0) 704 if (fd < 0)
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index ed479b6fef7b..e37f559c95e1 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -28,12 +28,13 @@
28#define FAN_CLASS_NOTIF 0x00000000 28#define FAN_CLASS_NOTIF 0x00000000
29#define FAN_CLASS_CONTENT 0x00000004 29#define FAN_CLASS_CONTENT 0x00000004
30#define FAN_CLASS_PRE_CONTENT 0x00000008 30#define FAN_CLASS_PRE_CONTENT 0x00000008
31
32#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \ 31#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \
33 FAN_CLASS_PRE_CONTENT) 32 FAN_CLASS_PRE_CONTENT)
34 33
34#define FAN_UNLIMITED_QUEUE 0x00000010
35
35#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \ 36#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \
36 FAN_ALL_CLASS_BITS) 37 FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE)
37 38
38/* flags used for fanotify_modify_mark() */ 39/* flags used for fanotify_modify_mark() */
39#define FAN_MARK_ADD 0x00000001 40#define FAN_MARK_ADD 0x00000001