Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>

authored by

Sascha Hauer and committed by
Mimi Zohar
4ece3125 f5e10401

+5
+5
security/integrity/ima/ima_crypto.c
··· 271 271 if (rc != rbuf_len) { 272 272 if (rc >= 0) 273 273 rc = -EINVAL; 274 + /* 275 + * Forward current rc, do not overwrite with return value 276 + * from ahash_wait() 277 + */ 278 + ahash_wait(ahash_rc, &wait); 274 279 goto out3; 275 280 } 276 281