summaryrefslogtreecommitdiffstats
path: root/kernel/audit_watch.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-12-18 02:12:05 +0100
committerEric Paris <eparis@redhat.com>2010-07-28 15:58:17 +0200
commita05fb6cc573130915380e00d182a4c6571cec6b2 (patch)
treec67e626c5307d89e6d7e65d0b2f9834c3591edb2 /kernel/audit_watch.c
parentaudit: redo audit watch locking and refcnt in light of fsnotify (diff)
downloadlinux-a05fb6cc573130915380e00d182a4c6571cec6b2.tar.xz
linux-a05fb6cc573130915380e00d182a4c6571cec6b2.zip
audit: do not get and put just to free a watch
deleting audit watch rules is not currently done under audit_filter_mutex. It was done this way because we could not hold the mutex during inotify manipulation. Since we are using fsnotify we don't need to do the extra get/put pair nor do we need the private list on which to store the parents while they are about to be freed. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'kernel/audit_watch.c')
-rw-r--r--kernel/audit_watch.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index da66197e3abc..75ab53987ece 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -55,7 +55,6 @@ struct audit_watch {
};
struct audit_parent {
- struct list_head ilist; /* tmp list used to free parents */
struct list_head watches; /* anchor for audit_watch->wlist */
struct fsnotify_mark_entry mark; /* fsnotify mark on the inode */
};
@@ -356,20 +355,6 @@ static void audit_remove_parent_watches(struct audit_parent *parent)
fsnotify_destroy_mark_by_entry(&parent->mark);
}
-/* Unregister inotify watches for parents on in_list.
- * Generates an FS_IGNORED event. */
-void audit_watch_inotify_unregister(struct list_head *in_list)
-{
- struct audit_parent *p, *n;
-
- list_for_each_entry_safe(p, n, in_list, ilist) {
- list_del(&p->ilist);
- fsnotify_destroy_mark_by_entry(&p->mark);
- /* matches the get in audit_remove_watch_rule() */
- audit_put_parent(p);
- }
-}
-
/* Get path information necessary for adding watches. */
static int audit_get_nd(char *path, struct nameidata **ndp, struct nameidata **ndw)
{
@@ -502,7 +487,7 @@ error:
}
-void audit_remove_watch_rule(struct audit_krule *krule, struct list_head *list)
+void audit_remove_watch_rule(struct audit_krule *krule)
{
struct audit_watch *watch = krule->watch;
struct audit_parent *parent = watch->parent;
@@ -513,15 +498,9 @@ void audit_remove_watch_rule(struct audit_krule *krule, struct list_head *list)
audit_remove_watch(watch);
if (list_empty(&parent->watches)) {
- /* Put parent on the un-registration list.
- * Grab a reference before releasing
- * audit_filter_mutex, to be released in
- * audit_watch_inotify_unregister().
- * If filesystem is going away, just leave
- * the sucker alone, eviction will take
- * care of it. */
audit_get_parent(parent);
- list_add(&parent->ilist, list);
+ fsnotify_destroy_mark_by_entry(&parent->mark);
+ audit_put_parent(parent);
}
}
}