Skip to content

Commit a65d9d1

Browse files
cschauflerpcmoore
authored andcommitted
ima: uncover hidden variable in ima_match_rules()
The variable name "prop" is inadvertently used twice in ima_match_rules(), resulting in incorrect use of the local variable when the function parameter should have been. Rename the local variable and correct the use of the parameter. Suggested-by: Roberto Sassu <roberto.sassu@huawei.com> Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> Acked-by: Roberto Sassu <roberto.sassu@huawei.com> [PM: subj tweak, Roberto's ACK] Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 8afd8c8 commit a65d9d1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

security/integrity/ima/ima_policy.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule,
635635
return false;
636636
for (i = 0; i < MAX_LSM_RULES; i++) {
637637
int rc = 0;
638-
struct lsm_prop prop = { };
638+
struct lsm_prop inode_prop = { };
639639

640640
if (!lsm_rule->lsm[i].rule) {
641641
if (!lsm_rule->lsm[i].args_p)
@@ -649,15 +649,16 @@ static bool ima_match_rules(struct ima_rule_entry *rule,
649649
case LSM_OBJ_USER:
650650
case LSM_OBJ_ROLE:
651651
case LSM_OBJ_TYPE:
652-
security_inode_getlsmprop(inode, &prop);
653-
rc = ima_filter_rule_match(&prop, lsm_rule->lsm[i].type,
652+
security_inode_getlsmprop(inode, &inode_prop);
653+
rc = ima_filter_rule_match(&inode_prop,
654+
lsm_rule->lsm[i].type,
654655
Audit_equal,
655656
lsm_rule->lsm[i].rule);
656657
break;
657658
case LSM_SUBJ_USER:
658659
case LSM_SUBJ_ROLE:
659660
case LSM_SUBJ_TYPE:
660-
rc = ima_filter_rule_match(&prop, lsm_rule->lsm[i].type,
661+
rc = ima_filter_rule_match(prop, lsm_rule->lsm[i].type,
661662
Audit_equal,
662663
lsm_rule->lsm[i].rule);
663664
break;

0 commit comments

Comments
 (0)