diff options
author | Eric Paris <eparis@redhat.com> | 2010-10-28 17:21:58 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-10-28 17:22:15 -0400 |
commit | 4afeff8505cb8a38e36c1ef2bd3447c4b8f87367 (patch) | |
tree | 50a80d8773698813e4e9d9f9112079c09d493c48 /fs/notify/fanotify/fanotify.c | |
parent | ac7e22dcfafd04c842a02057afd6541c1d613ef9 (diff) |
fanotify: limit number of listeners per user
fanotify currently has no limit on the number of listeners a given user can
have open. This patch limits the total number of listeners per user to
128. This is the same as the inotify default limit.
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/fanotify/fanotify.c')
-rw-r--r-- | fs/notify/fanotify/fanotify.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index 85366c78cc37..60c11c306fd9 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c | |||
@@ -200,10 +200,19 @@ static bool fanotify_should_send_event(struct fsnotify_group *group, | |||
200 | return false; | 200 | return false; |
201 | } | 201 | } |
202 | 202 | ||
203 | static void fanotify_free_group_priv(struct fsnotify_group *group) | ||
204 | { | ||
205 | struct user_struct *user; | ||
206 | |||
207 | user = group->fanotify_data.user; | ||
208 | atomic_dec(&user->fanotify_listeners); | ||
209 | free_uid(user); | ||
210 | } | ||
211 | |||
203 | const struct fsnotify_ops fanotify_fsnotify_ops = { | 212 | const struct fsnotify_ops fanotify_fsnotify_ops = { |
204 | .handle_event = fanotify_handle_event, | 213 | .handle_event = fanotify_handle_event, |
205 | .should_send_event = fanotify_should_send_event, | 214 | .should_send_event = fanotify_should_send_event, |
206 | .free_group_priv = NULL, | 215 | .free_group_priv = fanotify_free_group_priv, |
207 | .free_event_priv = NULL, | 216 | .free_event_priv = NULL, |
208 | .freeing_mark = NULL, | 217 | .freeing_mark = NULL, |
209 | }; | 218 | }; |