hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9KUX7
--------------------------------
Fixed "WARNING: suspicious RCU usage" warning on ima_update_policy_flag.
Fixes: bccda6c35b52 ("ima: fix deadlock when traversing "ima_default_rules".") Signed-off-by: GUO Zihua guozihua@huawei.com --- security/integrity/ima/ima_policy.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index a9dbfc7143b3..43a5c4754a66 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -759,11 +759,13 @@ void ima_update_policy_flag(void) struct ima_rule_entry *entry; struct list_head *ima_rules_tmp;
+ rcu_read_lock(); ima_rules_tmp = rcu_dereference(ima_rules); list_for_each_entry_rcu(entry, ima_rules_tmp, list) { if (entry->action & IMA_DO_MASK) ima_policy_flag |= entry->action; } + rcu_read_unlock();
ima_appraise |= (build_ima_appraise | temp_ima_appraise); if (!ima_appraise)