Skip to content

Commit

Permalink
audit: make audit_del_rule() more robust
Browse files Browse the repository at this point in the history
Move the access to the entry for audit_match_signal() to earlier in the
function in case the entry found is the same one passed in.  This will enable
it to be used by audit_remove_mark_rule().

Signed-off-by: Richard Guy Briggs <[email protected]>
[PM: tweaked subject line as it no longer made sense after multiple revs]
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
rgbriggs authored and pcmoore committed Aug 5, 2015
1 parent ae9d2fb commit 8c85fc9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kernel/auditfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,6 @@ static inline int audit_del_rule(struct audit_entry *entry)
mutex_lock(&audit_filter_mutex);
e = audit_find_rule(entry, &list);
if (!e) {
mutex_unlock(&audit_filter_mutex);
ret = -ENOENT;
goto out;
}
Expand All @@ -964,20 +963,21 @@ static inline int audit_del_rule(struct audit_entry *entry)
if (e->rule.tree)
audit_remove_tree_rule(&e->rule);

list_del_rcu(&e->list);
list_del(&e->rule.list);
call_rcu(&e->rcu, audit_free_rule_rcu);

#ifdef CONFIG_AUDITSYSCALL
if (!dont_count)
audit_n_rules--;

if (!audit_match_signal(entry))
audit_signals--;
#endif
mutex_unlock(&audit_filter_mutex);

list_del_rcu(&e->list);
list_del(&e->rule.list);
call_rcu(&e->rcu, audit_free_rule_rcu);

out:
mutex_unlock(&audit_filter_mutex);

if (tree)
audit_put_tree(tree); /* that's the temporary one */

Expand Down

0 comments on commit 8c85fc9

Please sign in to comment.