]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/notify/fanotify/fanotify.c
fanotify: limit number of listeners per user
[net-next-2.6.git] / fs / notify / fanotify / fanotify.c
index 85366c78cc3759b1a0027e1a3d5d0598e2f2fdec..60c11c306fd91429c3637baa4530f547d3c6c324 100644 (file)
@@ -200,10 +200,19 @@ static bool fanotify_should_send_event(struct fsnotify_group *group,
        return false;
 }
 
+static void fanotify_free_group_priv(struct fsnotify_group *group)
+{
+       struct user_struct *user;
+
+       user = group->fanotify_data.user;
+       atomic_dec(&user->fanotify_listeners);
+       free_uid(user);
+}
+
 const struct fsnotify_ops fanotify_fsnotify_ops = {
        .handle_event = fanotify_handle_event,
        .should_send_event = fanotify_should_send_event,
-       .free_group_priv = NULL,
+       .free_group_priv = fanotify_free_group_priv,
        .free_event_priv = NULL,
        .freeing_mark = NULL,
 };