IMA: use list_splice_tail_init_rcu() instead of its open coded variant

Use list_splice_tail_init_rcu() to extend the existing custom IMA policy
with additional IMA policy rules.

Signed-off-by: Petko Manolov <petko.manolov@konsulko.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
This commit is contained in:
Petko Manolov 2018-05-22 17:06:55 +03:00 committed by Mimi Zohar
parent b4df86085a
commit 53b626f903
1 changed files with 2 additions and 15 deletions

View File

@ -527,22 +527,9 @@ int ima_check_policy(void)
*/
void ima_update_policy(void)
{
struct list_head *first, *last, *policy;
struct list_head *policy = &ima_policy_rules;
/* append current policy with the new rules */
first = (&ima_temp_rules)->next;
last = (&ima_temp_rules)->prev;
policy = &ima_policy_rules;
synchronize_rcu();
last->next = policy;
rcu_assign_pointer(list_next_rcu(policy->prev), first);
first->prev = policy->prev;
policy->prev = last;
/* prepare for the next policy rules addition */
INIT_LIST_HEAD(&ima_temp_rules);
list_splice_tail_init_rcu(&ima_temp_rules, policy, synchronize_rcu);
if (ima_rules != policy) {
ima_policy_flag = 0;