aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/audit_watch.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-07-28 10:18:38 -0400
committerEric Paris <eparis@redhat.com>2010-07-28 10:18:53 -0400
commit4cd76a47924cd966799402d0f2bba356cde5c1b3 (patch)
treeeae3de25da0f48b105422dc93301bb1705b3fe0b /kernel/audit_watch.c
parentc496313fcc35a41e176e3f19cdda2544ea3a32a6 (diff)
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: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'kernel/audit_watch.c')
-rw-r--r--kernel/audit_watch.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index 4d5ea0319a6c..9173bcf33763 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -514,18 +514,10 @@ static bool audit_watch_should_send_event(struct fsnotify_group *group, struct i
514 struct vfsmount *mnt, struct fsnotify_mark *mark, 514 struct vfsmount *mnt, struct fsnotify_mark *mark,
515 __u32 mask, void *data, int data_type) 515 __u32 mask, void *data, int data_type)
516{ 516{
517 struct fsnotify_mark *entry;
518 bool send; 517 bool send;
519 518
520 entry = fsnotify_find_inode_mark(group, inode);
521 if (!entry)
522 return false;
523
524 mask = (mask & ~FS_EVENT_ON_CHILD); 519 mask = (mask & ~FS_EVENT_ON_CHILD);
525 send = (entry->mask & mask); 520 send = (mark->mask & mask);
526
527 /* find took a reference */
528 fsnotify_put_mark(entry);
529 521
530 return send; 522 return send;
531} 523}
@@ -540,11 +532,9 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
540 const char *dname = event->file_name; 532 const char *dname = event->file_name;
541 struct audit_parent *parent; 533 struct audit_parent *parent;
542 534
543 BUG_ON(group != audit_watch_group); 535 parent = container_of(mark, struct audit_parent, mark);
544 536
545 parent = audit_find_parent(event->to_tell); 537 BUG_ON(group != audit_watch_group);
546 if (unlikely(!parent))
547 return 0;
548 538
549 switch (event->data_type) { 539 switch (event->data_type) {
550 case (FSNOTIFY_EVENT_FILE): 540 case (FSNOTIFY_EVENT_FILE):
@@ -565,10 +555,6 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
565 audit_update_watch(parent, dname, (dev_t)-1, (unsigned long)-1, 1); 555 audit_update_watch(parent, dname, (dev_t)-1, (unsigned long)-1, 1);
566 else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF)) 556 else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF))
567 audit_remove_parent_watches(parent); 557 audit_remove_parent_watches(parent);
568 /* moved put_inotify_watch to freeing mark */
569
570 /* matched the ref taken by audit_find_parent */
571 audit_put_parent(parent);
572 558
573 return 0; 559 return 0;
574} 560}