]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ima: always return negative code for error
authorSascha Hauer <s.hauer@pengutronix.de>
Tue, 2 Jul 2019 08:00:40 +0000 (10:00 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 12 Nov 2019 18:04:21 +0000 (19:04 +0100)
commitcec581f477178b4407f8c37f7fbbd025de5df2bf
tree6686b53e2b8bb8d4d64315f36c19672e79467864
parent2e85f3b1df2371eb3309fa9745bb6888c6a6b04c
ima: always return negative code for error

BugLink: https://bugs.launchpad.net/bugs/1849576
[ Upstream commit f5e1040196dbfe14c77ce3dfe3b7b08d2d961e88 ]

integrity_kernel_read() returns the number of bytes read. If this is
a short read then this positive value is returned from
ima_calc_file_hash_atfm(). Currently this is only indirectly called from
ima_calc_file_hash() and this function only tests for the return value
being zero or nonzero and also doesn't forward the return value.
Nevertheless there's no point in returning a positive value as an error,
so translate a short read into -EINVAL.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
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: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
security/integrity/ima/ima_crypto.c