]> www.infradead.org Git - nvme.git/commitdiff
ima: ignore suffixed policy rule comments
authorMimi Zohar <zohar@linux.ibm.com>
Fri, 27 Dec 2024 13:28:32 +0000 (08:28 -0500)
committerMimi Zohar <zohar@linux.ibm.com>
Fri, 3 Jan 2025 15:18:43 +0000 (10:18 -0500)
Lines beginning with '#' in the IMA policy are comments and are ignored.
Instead of placing the rule and comment on separate lines, allow the
comment to be suffixed to the IMA policy rule.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
security/integrity/ima/ima_policy.c

index 23bbe2c405f0188ec84d4d1c3b252dfa2b5530ae..128fab8979308ac7e5489f21ebf550b22b264d61 100644 (file)
@@ -1432,7 +1432,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
                int token;
                unsigned long lnum;
 
-               if (result < 0)
+               if (result < 0 || *p == '#')  /* ignore suffixed comment */
                        break;
                if ((*p == '\0') || (*p == ' ') || (*p == '\t'))
                        continue;