diff options
| -rw-r--r-- | fs/notify/fanotify/fanotify.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index 58772623f02a..cc78e2fbc8e4 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c | |||
| @@ -16,12 +16,6 @@ static bool should_merge(struct fsnotify_event *old_fsn, | |||
| 16 | { | 16 | { |
| 17 | struct fanotify_event_info *old, *new; | 17 | struct fanotify_event_info *old, *new; |
| 18 | 18 | ||
| 19 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | ||
| 20 | /* dont merge two permission events */ | ||
| 21 | if ((old_fsn->mask & FAN_ALL_PERM_EVENTS) && | ||
| 22 | (new_fsn->mask & FAN_ALL_PERM_EVENTS)) | ||
| 23 | return false; | ||
| 24 | #endif | ||
| 25 | pr_debug("%s: old=%p new=%p\n", __func__, old_fsn, new_fsn); | 19 | pr_debug("%s: old=%p new=%p\n", __func__, old_fsn, new_fsn); |
| 26 | old = FANOTIFY_E(old_fsn); | 20 | old = FANOTIFY_E(old_fsn); |
| 27 | new = FANOTIFY_E(new_fsn); | 21 | new = FANOTIFY_E(new_fsn); |
| @@ -42,6 +36,16 @@ static struct fsnotify_event *fanotify_merge(struct list_head *list, | |||
| 42 | 36 | ||
| 43 | pr_debug("%s: list=%p event=%p\n", __func__, list, event); | 37 | pr_debug("%s: list=%p event=%p\n", __func__, list, event); |
| 44 | 38 | ||
| 39 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | ||
| 40 | /* | ||
| 41 | * Don't merge a permission event with any other event so that we know | ||
| 42 | * the event structure we have created in fanotify_handle_event() is the | ||
| 43 | * one we should check for permission response. | ||
| 44 | */ | ||
| 45 | if (event->mask & FAN_ALL_PERM_EVENTS) | ||
| 46 | return NULL; | ||
| 47 | #endif | ||
| 48 | |||
| 45 | list_for_each_entry_reverse(test_event, list, list) { | 49 | list_for_each_entry_reverse(test_event, list, list) { |
| 46 | if (should_merge(test_event, event)) { | 50 | if (should_merge(test_event, event)) { |
| 47 | do_merge = true; | 51 | do_merge = true; |
| @@ -195,13 +199,10 @@ static int fanotify_handle_event(struct fsnotify_group *group, | |||
| 195 | fsnotify_destroy_event(group, fsn_event); | 199 | fsnotify_destroy_event(group, fsn_event); |
| 196 | if (IS_ERR(notify_fsn_event)) | 200 | if (IS_ERR(notify_fsn_event)) |
| 197 | return PTR_ERR(notify_fsn_event); | 201 | return PTR_ERR(notify_fsn_event); |
| 198 | /* We need to ask about a different events after a merge... */ | ||
| 199 | event = FANOTIFY_E(notify_fsn_event); | ||
| 200 | fsn_event = notify_fsn_event; | ||
| 201 | } | 202 | } |
| 202 | 203 | ||
| 203 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 204 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
| 204 | if (fsn_event->mask & FAN_ALL_PERM_EVENTS) | 205 | if (mask & FAN_ALL_PERM_EVENTS) |
| 205 | ret = fanotify_get_response_from_access(group, event); | 206 | ret = fanotify_get_response_from_access(group, event); |
| 206 | #endif | 207 | #endif |
| 207 | return ret; | 208 | return ret; |
