mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
audit: make audit_del_rule() more robust
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 <rgb@redhat.com> [PM: tweaked subject line as it no longer made sense after multiple revs] Signed-off-by: Paul Moore <pmoore@redhat.com>
This commit is contained in:
committed by
Paul Moore
parent
ae9d2fb482
commit
8c85fc9ae6
@@ -953,7 +953,6 @@ static inline int audit_del_rule(struct audit_entry *entry)
|
|||||||
mutex_lock(&audit_filter_mutex);
|
mutex_lock(&audit_filter_mutex);
|
||||||
e = audit_find_rule(entry, &list);
|
e = audit_find_rule(entry, &list);
|
||||||
if (!e) {
|
if (!e) {
|
||||||
mutex_unlock(&audit_filter_mutex);
|
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -964,10 +963,6 @@ static inline int audit_del_rule(struct audit_entry *entry)
|
|||||||
if (e->rule.tree)
|
if (e->rule.tree)
|
||||||
audit_remove_tree_rule(&e->rule);
|
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
|
#ifdef CONFIG_AUDITSYSCALL
|
||||||
if (!dont_count)
|
if (!dont_count)
|
||||||
audit_n_rules--;
|
audit_n_rules--;
|
||||||
@@ -975,9 +970,14 @@ static inline int audit_del_rule(struct audit_entry *entry)
|
|||||||
if (!audit_match_signal(entry))
|
if (!audit_match_signal(entry))
|
||||||
audit_signals--;
|
audit_signals--;
|
||||||
#endif
|
#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:
|
out:
|
||||||
|
mutex_unlock(&audit_filter_mutex);
|
||||||
|
|
||||||
if (tree)
|
if (tree)
|
||||||
audit_put_tree(tree); /* that's the temporary one */
|
audit_put_tree(tree); /* that's the temporary one */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user