[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200421090442.22693-1-roberto.sassu@huawei.com>
Date: Tue, 21 Apr 2020 11:04:42 +0200
From: Roberto Sassu <roberto.sassu@...wei.com>
To: <zohar@...ux.ibm.com>
CC: <linux-integrity@...r.kernel.org>,
<linux-security-module@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <silviu.vlasceanu@...wei.com>,
Roberto Sassu <roberto.sassu@...wei.com>,
<stable@...r.kernel.org>
Subject: [PATCH] ima: Fix return value of ima_write_policy()
Return datalen instead of zero if there is a rule to appraise the policy
but that rule is not enforced.
Cc: stable@...r.kernel.org
Fixes: 19f8a84713edc ("ima: measure and appraise the IMA policy itself")
Signed-off-by: Roberto Sassu <roberto.sassu@...wei.com>
---
security/integrity/ima/ima_fs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
index a71e822a6e92..2c2ea814b954 100644
--- a/security/integrity/ima/ima_fs.c
+++ b/security/integrity/ima/ima_fs.c
@@ -340,6 +340,8 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf,
1, 0);
if (ima_appraise & IMA_APPRAISE_ENFORCE)
result = -EACCES;
+ else
+ result = datalen;
} else {
result = ima_parse_add_rule(data);
}
--
2.17.1
Powered by blists - more mailing lists