aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/notify/fanotify/fanotify.c2
-rw-r--r--fs/notify/fanotify/fanotify_user.c5
-rw-r--r--include/linux/fanotify.h6
3 files changed, 12 insertions, 1 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 03498eb995be..361e3a0a445c 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -205,6 +205,8 @@ static int fanotify_handle_event(struct fsnotify_group *group,
205 BUILD_BUG_ON(FAN_ACCESS_PERM != FS_ACCESS_PERM); 205 BUILD_BUG_ON(FAN_ACCESS_PERM != FS_ACCESS_PERM);
206 BUILD_BUG_ON(FAN_ONDIR != FS_ISDIR); 206 BUILD_BUG_ON(FAN_ONDIR != FS_ISDIR);
207 207
208 BUILD_BUG_ON(HWEIGHT32(ALL_FANOTIFY_EVENT_BITS) != 10);
209
208 if (!fanotify_should_send_event(iter_info, mask, data, data_type)) 210 if (!fanotify_should_send_event(iter_info, mask, data, data_type))
209 return 0; 211 return 0;
210 212
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 530e5e486105..14594e491d2b 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -803,7 +803,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
803 struct fsnotify_group *group; 803 struct fsnotify_group *group;
804 struct fd f; 804 struct fd f;
805 struct path path; 805 struct path path;
806 u32 valid_mask = FANOTIFY_EVENTS | FAN_EVENT_ON_CHILD | FAN_ONDIR; 806 u32 valid_mask = FANOTIFY_EVENTS | FANOTIFY_EVENT_FLAGS;
807 unsigned int mark_type = flags & FANOTIFY_MARK_TYPE_BITS; 807 unsigned int mark_type = flags & FANOTIFY_MARK_TYPE_BITS;
808 int ret; 808 int ret;
809 809
@@ -944,6 +944,9 @@ COMPAT_SYSCALL_DEFINE6(fanotify_mark,
944 */ 944 */
945static int __init fanotify_user_setup(void) 945static int __init fanotify_user_setup(void)
946{ 946{
947 BUILD_BUG_ON(HWEIGHT32(FANOTIFY_INIT_FLAGS) != 6);
948 BUILD_BUG_ON(HWEIGHT32(FANOTIFY_MARK_FLAGS) != 9);
949
947 fanotify_mark_cache = KMEM_CACHE(fsnotify_mark, 950 fanotify_mark_cache = KMEM_CACHE(fsnotify_mark,
948 SLAB_PANIC|SLAB_ACCOUNT); 951 SLAB_PANIC|SLAB_ACCOUNT);
949 fanotify_event_cachep = KMEM_CACHE(fanotify_event_info, SLAB_PANIC); 952 fanotify_event_cachep = KMEM_CACHE(fanotify_event_info, SLAB_PANIC);
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index 4519b0988afe..caf55c67fc6c 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -41,11 +41,17 @@
41/* Events that require a permission response from user */ 41/* Events that require a permission response from user */
42#define FANOTIFY_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM) 42#define FANOTIFY_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM)
43 43
44/* Extra flags that may be reported with event or control handling of events */
45#define FANOTIFY_EVENT_FLAGS (FAN_EVENT_ON_CHILD | FAN_ONDIR)
46
44/* Events that may be reported to user */ 47/* Events that may be reported to user */
45#define FANOTIFY_OUTGOING_EVENTS (FANOTIFY_EVENTS | \ 48#define FANOTIFY_OUTGOING_EVENTS (FANOTIFY_EVENTS | \
46 FANOTIFY_PERM_EVENTS | \ 49 FANOTIFY_PERM_EVENTS | \
47 FAN_Q_OVERFLOW) 50 FAN_Q_OVERFLOW)
48 51
52#define ALL_FANOTIFY_EVENT_BITS (FANOTIFY_OUTGOING_EVENTS | \
53 FANOTIFY_EVENT_FLAGS)
54
49/* Do not use these old uapi constants internally */ 55/* Do not use these old uapi constants internally */
50#undef FAN_ALL_CLASS_BITS 56#undef FAN_ALL_CLASS_BITS
51#undef FAN_ALL_INIT_FLAGS 57#undef FAN_ALL_INIT_FLAGS