crypto: caam - fix signals handling
authorHoria Geantă <horia.geanta@nxp.com>
Fri, 7 Jul 2017 13:57:06 +0000 (16:57 +0300)
committerWilly Tarreau <w@1wt.eu>
Thu, 2 Nov 2017 09:45:57 +0000 (10:45 +0100)
commit7fb443fa86195a13277194e5f112445d982e639e
tree1ec413a46bf02f590c0870c4f7960f79ff84850a
parentb569326cedfc6e0f2dc1c3cc237ad717e4a5b0f4
crypto: caam - fix signals handling

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).

Cc: <stable@vger.kernel.org>
Fixes: 045e36780f115 ("crypto: caam - ahash hmac support")
Fixes: 4c1ec1f930154 ("crypto: caam - refactor key_gen, sg")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/crypto/caam/caamhash.c
drivers/crypto/caam/key_gen.c