ima: fix error handling logic when file measurement failed
authorMatt Bobrowski <mattbobrowski@google.com>
Wed, 4 Jan 2023 03:41:44 +0000 (03:41 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:15 +0000 (09:34 +0100)
commit7327b30a00842768f18345e21e35a3625ce9b2fe
treec6683f3e1289695e7bf77aca9b3cb9ad3aec922b
parent1beb41094bbf3c38edfb16b4ee0ed8ac7ca5e253
ima: fix error handling logic when file measurement failed

commit 6dc387d52eb67f45d68caa263704fa4e39ef8e76 upstream.

Restore the error handling logic so that when file measurement fails,
the respective iint entry is not left with the digest data being
populated with zeroes.

Fixes: 54f03916fb89 ("ima: permit fsverity's file digests in the IMA measurement list")
Cc: stable@vger.kernel.org # 5.19
Signed-off-by: Matt Bobrowski <mattbobrowski@google.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/integrity/ima/ima_api.c
security/integrity/ima/ima_main.c