diff options
author | Eric Paris <eparis@redhat.com> | 2009-12-17 20:12:05 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:17 -0400 |
commit | a05fb6cc573130915380e00d182a4c6571cec6b2 (patch) | |
tree | c67e626c5307d89e6d7e65d0b2f9834c3591edb2 /kernel/audit_watch.c | |
parent | e118e9c5638bbe877aa26b5cd2fd223cc24cdc8a (diff) |
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.c | 27 |
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 { | |||
55 | }; | 55 | }; |
56 | 56 | ||
57 | struct audit_parent { | 57 | struct audit_parent { |
58 | struct list_head ilist; /* tmp list used to free parents */ | ||
59 | struct list_head watches; /* anchor for audit_watch->wlist */ | 58 | struct list_head watches; /* anchor for audit_watch->wlist */ |
60 | struct fsnotify_mark_entry mark; /* fsnotify mark on the inode */ | 59 | struct fsnotify_mark_entry mark; /* fsnotify mark on the inode */ |
61 | }; | 60 | }; |
@@ -356,20 +355,6 @@ static void audit_remove_parent_watches(struct audit_parent *parent) | |||
356 | fsnotify_destroy_mark_by_entry(&parent->mark); | 355 | fsnotify_destroy_mark_by_entry(&parent->mark); |
357 | } | 356 | } |
358 | 357 | ||
359 | /* Unregister inotify watches for parents on in_list. | ||
360 | * Generates an FS_IGNORED event. */ | ||
361 | void audit_watch_inotify_unregister(struct list_head *in_list) | ||
362 | { | ||
363 | struct audit_parent *p, *n; | ||
364 | |||
365 | list_for_each_entry_safe(p, n, in_list, ilist) { | ||
366 | list_del(&p->ilist); | ||
367 | fsnotify_destroy_mark_by_entry(&p->mark); | ||
368 | /* matches the get in audit_remove_watch_rule() */ | ||
369 | audit_put_parent(p); | ||
370 | } | ||
371 | } | ||
372 | |||
373 | /* Get path information necessary for adding watches. */ | 358 | /* Get path information necessary for adding watches. */ |
374 | static int audit_get_nd(char *path, struct nameidata **ndp, struct nameidata **ndw) | 359 | static int audit_get_nd(char *path, struct nameidata **ndp, struct nameidata **ndw) |
375 | { | 360 | { |
@@ -502,7 +487,7 @@ error: | |||
502 | 487 | ||
503 | } | 488 | } |
504 | 489 | ||
505 | void audit_remove_watch_rule(struct audit_krule *krule, struct list_head *list) | 490 | void audit_remove_watch_rule(struct audit_krule *krule) |
506 | { | 491 | { |
507 | struct audit_watch *watch = krule->watch; | 492 | struct audit_watch *watch = krule->watch; |
508 | struct audit_parent *parent = watch->parent; | 493 | struct audit_parent *parent = watch->parent; |
@@ -513,15 +498,9 @@ void audit_remove_watch_rule(struct audit_krule *krule, struct list_head *list) | |||
513 | audit_remove_watch(watch); | 498 | audit_remove_watch(watch); |
514 | 499 | ||
515 | if (list_empty(&parent->watches)) { | 500 | if (list_empty(&parent->watches)) { |
516 | /* Put parent on the un-registration list. | ||
517 | * Grab a reference before releasing | ||
518 | * audit_filter_mutex, to be released in | ||
519 | * audit_watch_inotify_unregister(). | ||
520 | * If filesystem is going away, just leave | ||
521 | * the sucker alone, eviction will take | ||
522 | * care of it. */ | ||
523 | audit_get_parent(parent); | 501 | audit_get_parent(parent); |
524 | list_add(&parent->ilist, list); | 502 | fsnotify_destroy_mark_by_entry(&parent->mark); |
503 | audit_put_parent(parent); | ||
525 | } | 504 | } |
526 | } | 505 | } |
527 | } | 506 | } |