Skip to contentSkip to conversation

Patch "crypto: caam - fix signals handling" has been added to the 4.12-stable tree

PATCH [email protected] 1 participant 1 message Jul 19, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

crypto: caam - fix signals handling

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
crypto-caam-fix-signals-handling.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 7459e1d25ffefa2b1be799477fcc1f6c62f6cec7 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Horia=20Geant=C4=83?= <[email protected]>
Date: Fri, 7 Jul 2017 16:57:06 +0300
Subject: crypto: caam - fix signals handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Horia Geantă <[email protected]>

commit 7459e1d25ffefa2b1be799477fcc1f6c62f6cec7 upstream.

Driver does not properly handle the case when signals interrupt wait_for_completion_interruptible():
-it does not check for return value
-completion structure is allocated on stack; in case a signal interrupts the sleep, it will go out of scope, causing the worker thread (caam_jr_dequeue) to fail when it accesses it

wait_for_completion_interruptible() is replaced with uninterruptable wait_for_completion().
We choose to block all signals while waiting for I/O (device executing the split key generation job descriptor) since the alternative - in order to have a deterministic device state - would be to flush the job ring (aborting *all* in-progress jobs).

Fixes 045e36780f115 ("crypto: caam - ahash hmac support")
Fixes 4c1ec1f930154 ("crypto: caam - refactor key_gen, sg")
---
 drivers/crypto/caam/caamhash.c |    2 +-
 drivers/crypto/caam/key_gen.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/caam/caamhash.c +1 -1
@@ -396,7 +396,7 @@ static int hash_digest_key(struct caam_h
 	ret = caam_jr_enqueue(jrdev, desc, split_key_done, &result);
 	if (!ret) {
 		/* in progress */
-		wait_for_completion_interruptible(&result.completion);
+		wait_for_completion(&result.completion);
 		ret = result.err;
 #ifdef DEBUG
 		print_hex_dump(KERN_ERR,
drivers/crypto/caam/key_gen.c +1 -1
@@ -149,7 +149,7 @@ int gen_split_key(struct device *jrdev,
 	ret = caam_jr_enqueue(jrdev, desc, split_key_done, &result);
 	if (!ret) {
 		/* in progress */
-		wait_for_completion_interruptible(&result.completion);
+		wait_for_completion(&result.completion);
 		ret = result.err;
 #ifdef DEBUG
 		print_hex_dump(KERN_ERR, "ctx.key@"__stringify(__LINE__)": ",

Patches currently in stable-queue which might be from [email protected] are

queue-4.12/crypto-caam-properly-set-iv-after-en-de-crypt.patch queue-4.12/crypto-talitos-extend-max-key-length-for-sha384-512-hmac-and-aead.patch queue-4.12/crypto-caam-fix-signals-handling.patch