Commit 4ece3125 authored by Sascha Hauer's avatar Sascha Hauer Committed by Mimi Zohar

ima: fix freeing ongoing ahash_request

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: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
parent f5e10401
...@@ -271,6 +271,11 @@ static int ima_calc_file_hash_atfm(struct file *file, ...@@ -271,6 +271,11 @@ static int ima_calc_file_hash_atfm(struct file *file,
if (rc != rbuf_len) { if (rc != rbuf_len) {
if (rc >= 0) if (rc >= 0)
rc = -EINVAL; rc = -EINVAL;
/*
* Forward current rc, do not overwrite with return value
* from ahash_wait()
*/
ahash_wait(ahash_rc, &wait);
goto out3; goto out3;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment