Commit 4cd76a47 authored by Eric Paris's avatar Eric Paris

audit: use the mark in handler functions

audit now gets a mark in the should_send_event and handle_event
functions.  Rather than look up the mark themselves audit should just use
the mark it was handed.
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
parent c496313f
...@@ -514,18 +514,10 @@ static bool audit_watch_should_send_event(struct fsnotify_group *group, struct i ...@@ -514,18 +514,10 @@ static bool audit_watch_should_send_event(struct fsnotify_group *group, struct i
struct vfsmount *mnt, struct fsnotify_mark *mark, struct vfsmount *mnt, struct fsnotify_mark *mark,
__u32 mask, void *data, int data_type) __u32 mask, void *data, int data_type)
{ {
struct fsnotify_mark *entry;
bool send; bool send;
entry = fsnotify_find_inode_mark(group, inode);
if (!entry)
return false;
mask = (mask & ~FS_EVENT_ON_CHILD); mask = (mask & ~FS_EVENT_ON_CHILD);
send = (entry->mask & mask); send = (mark->mask & mask);
/* find took a reference */
fsnotify_put_mark(entry);
return send; return send;
} }
...@@ -540,11 +532,9 @@ static int audit_watch_handle_event(struct fsnotify_group *group, ...@@ -540,11 +532,9 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
const char *dname = event->file_name; const char *dname = event->file_name;
struct audit_parent *parent; 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); BUG_ON(group != audit_watch_group);
if (unlikely(!parent))
return 0;
switch (event->data_type) { switch (event->data_type) {
case (FSNOTIFY_EVENT_FILE): case (FSNOTIFY_EVENT_FILE):
...@@ -565,10 +555,6 @@ static int audit_watch_handle_event(struct fsnotify_group *group, ...@@ -565,10 +555,6 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
audit_update_watch(parent, dname, (dev_t)-1, (unsigned long)-1, 1); audit_update_watch(parent, dname, (dev_t)-1, (unsigned long)-1, 1);
else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF)) else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF))
audit_remove_parent_watches(parent); 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment