]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - kernel/audit_watch.c
audit: use the mark in handler functions
[net-next-2.6.git] / kernel / audit_watch.c
index b955a22d8ff19ed01703e1502a561309d85ce6a7..9173bcf33763a8c803bec77b98154ee0d2f4aaa1 100644 (file)
@@ -511,38 +511,30 @@ void audit_remove_watch_rule(struct audit_krule *krule)
 }
 
 static bool audit_watch_should_send_event(struct fsnotify_group *group, struct inode *inode,
-                                         struct vfsmount *mnt, __u32 mask, void *data,
-                                         int data_type)
+                                         struct vfsmount *mnt, struct fsnotify_mark *mark,
+                                         __u32 mask, void *data, int data_type)
 {
-       struct fsnotify_mark *entry;
        bool send;
 
-       entry = fsnotify_find_inode_mark(group, inode);
-       if (!entry)
-               return false;
-
        mask = (mask & ~FS_EVENT_ON_CHILD);
-       send = (entry->mask & mask);
-
-       /* find took a reference */
-       fsnotify_put_mark(entry);
+       send = (mark->mask & mask);
 
        return send;
 }
 
 /* Update watch data in audit rules based on fsnotify events. */
-static int audit_watch_handle_event(struct fsnotify_group *group, struct fsnotify_event *event)
+static int audit_watch_handle_event(struct fsnotify_group *group,
+                                   struct fsnotify_mark *mark,
+                                   struct fsnotify_event *event)
 {
        struct inode *inode;
        __u32 mask = event->mask;
        const char *dname = event->file_name;
        struct audit_parent *parent;
 
-       BUG_ON(group != audit_watch_group);
+       parent = container_of(mark, struct audit_parent, mark);
 
-       parent = audit_find_parent(event->to_tell);
-       if (unlikely(!parent))
-               return 0;
+       BUG_ON(group != audit_watch_group);
 
        switch (event->data_type) {
        case (FSNOTIFY_EVENT_FILE):
@@ -563,10 +555,6 @@ static int audit_watch_handle_event(struct fsnotify_group *group, struct fsnotif
                audit_update_watch(parent, dname, (dev_t)-1, (unsigned long)-1, 1);
        else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF))
                audit_remove_parent_watches(parent);
-       /* moved put_inotify_watch to freeing mark */
-
-       /* matched the ref taken by audit_find_parent */
-       audit_put_parent(parent);
 
        return 0;
 }