Skip to content

Commit

Permalink
ima: fix freeing ongoing ahash_request
Browse files Browse the repository at this point in the history
integrity_kernel_read() can fail in which case we forward to call
ahash_request_free() on a currently running request. We have to wait
for its completion before we can free the request.

This was observed by interrupting a "find / -type f -xdev -print0 | xargs -0
cat 1>/dev/null" with ctrl-c on an IMA enabled filesystem.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
  • Loading branch information
saschahauer authored and mimizohar committed Aug 5, 2019
1 parent f5e1040 commit 4ece312
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions security/integrity/ima/ima_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ static int ima_calc_file_hash_atfm(struct file *file,
if (rc != rbuf_len) {
if (rc >= 0)
rc = -EINVAL;
/*
* Forward current rc, do not overwrite with return value
* from ahash_wait()
*/
ahash_wait(ahash_rc, &wait);
goto out3;
}

Expand Down

0 comments on commit 4ece312

Please sign in to comment.