]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
ima: Fix return value of ima_write_policy()
authorRoberto Sassu <roberto.sassu@huawei.com>
Mon, 27 Apr 2020 10:31:28 +0000 (12:31 +0200)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Mon, 22 Jun 2020 20:22:20 +0000 (17:22 -0300)
commit66f01d10de1d1353bc1a4c75a725013da45387a4
treedd43b1e85f6e0a6302512c7182bfcd1d894a8a58
parent02bc8093dc5512f2abfa07947d2d98a049211862
ima: Fix return value of ima_write_policy()

BugLink: https://bugs.launchpad.net/bugs/1881178
[ Upstream commit 2e3a34e9f409ebe83d1af7cd2f49fca7af97dfac ]

This patch fixes the return value of ima_write_policy() when a new policy
is directly passed to IMA and the current policy requires appraisal of the
file containing the policy. Currently, if appraisal is not in ENFORCE mode,
ima_write_policy() returns 0 and leads user space applications to an
endless loop. Fix this issue by denying the operation regardless of the
appraisal mode.

Cc: stable@vger.kernel.org # 4.10.x
Fixes: 19f8a84713edc ("ima: measure and appraise the IMA policy itself")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Krzysztof Struczynski <krzysztof.struczynski@huawei.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
security/integrity/ima/ima_fs.c