diff options
-rw-r--r-- | fs/notify/fanotify/fanotify_user.c | 6 | ||||
-rw-r--r-- | include/linux/fsnotify_backend.h | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index da01091f93eb..7182c83be90e 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -81,7 +81,7 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event) | |||
81 | * are NULL; That's fine, just don't call dentry open */ | 81 | * are NULL; That's fine, just don't call dentry open */ |
82 | if (dentry && mnt) | 82 | if (dentry && mnt) |
83 | new_file = dentry_open(dentry, mnt, | 83 | new_file = dentry_open(dentry, mnt, |
84 | O_RDONLY | O_LARGEFILE | FMODE_NONOTIFY, | 84 | group->fanotify_data.f_flags | FMODE_NONOTIFY, |
85 | current_cred()); | 85 | current_cred()); |
86 | else | 86 | else |
87 | new_file = ERR_PTR(-EOVERFLOW); | 87 | new_file = ERR_PTR(-EOVERFLOW); |
@@ -625,9 +625,6 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
625 | pr_debug("%s: flags=%d event_f_flags=%d\n", | 625 | pr_debug("%s: flags=%d event_f_flags=%d\n", |
626 | __func__, flags, event_f_flags); | 626 | __func__, flags, event_f_flags); |
627 | 627 | ||
628 | if (event_f_flags) | ||
629 | return -EINVAL; | ||
630 | |||
631 | if (!capable(CAP_SYS_ADMIN)) | 628 | if (!capable(CAP_SYS_ADMIN)) |
632 | return -EACCES; | 629 | return -EACCES; |
633 | 630 | ||
@@ -645,6 +642,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
645 | if (IS_ERR(group)) | 642 | if (IS_ERR(group)) |
646 | return PTR_ERR(group); | 643 | return PTR_ERR(group); |
647 | 644 | ||
645 | group->fanotify_data.f_flags = event_f_flags; | ||
648 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 646 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
649 | mutex_init(&group->fanotify_data.access_mutex); | 647 | mutex_init(&group->fanotify_data.access_mutex); |
650 | init_waitqueue_head(&group->fanotify_data.access_waitq); | 648 | init_waitqueue_head(&group->fanotify_data.access_waitq); |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index a46355db1e47..a83859d7d36e 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -169,14 +169,17 @@ struct fsnotify_group { | |||
169 | struct user_struct *user; | 169 | struct user_struct *user; |
170 | } inotify_data; | 170 | } inotify_data; |
171 | #endif | 171 | #endif |
172 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 172 | #ifdef CONFIG_FANOTIFY |
173 | struct fanotify_group_private_data { | 173 | struct fanotify_group_private_data { |
174 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | ||
174 | /* allows a group to block waiting for a userspace response */ | 175 | /* allows a group to block waiting for a userspace response */ |
175 | struct mutex access_mutex; | 176 | struct mutex access_mutex; |
176 | struct list_head access_list; | 177 | struct list_head access_list; |
177 | wait_queue_head_t access_waitq; | 178 | wait_queue_head_t access_waitq; |
179 | #endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */ | ||
180 | int f_flags; | ||
178 | } fanotify_data; | 181 | } fanotify_data; |
179 | #endif | 182 | #endif /* CONFIG_FANOTIFY */ |
180 | }; | 183 | }; |
181 | }; | 184 | }; |
182 | 185 | ||