1
0
Fork 0
remarkable-linux/drivers/crypto/inside-secure
Antoine Tenart 2b2a92910c crypto: inside-secure - fix the invalidation step during cra_exit
[ Upstream commit b7007dbccd ]

When exiting a transformation, the cra_exit() helper is called in each
driver providing one. The Inside Secure SafeXcel driver has one, which
is responsible of freeing some areas and of sending one invalidation
request to the crypto engine, to invalidate the context that was used
during the transformation.

We could see in some setups (when lots of transformations were being
used with a short lifetime, and hence lots of cra_exit() calls) NULL
pointer dereferences and other weird issues. All these issues were
coming from accessing the tfm context.

The issue is the invalidation request completion is checked using a
wait_for_completion_interruptible() call in both the cipher and hash
cra_exit() helpers. In some cases this was interrupted while the
invalidation request wasn't processed yet. And then cra_exit() returned,
and its caller was freeing the tfm instance. Only then the request was
being handled by the SafeXcel driver, which lead to the said issues.

This patch fixes this by using wait_for_completion() calls in these
specific cases.

Fixes: 1b44c5a60c ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 16:17:46 +02:00
..
Makefile
safexcel.c crypto: inside-secure - do not process request if no command was issued 2018-05-25 16:17:45 +02:00
safexcel.h crypto: inside-secure - increase the batch size 2017-06-20 11:21:47 +08:00
safexcel_cipher.c crypto: inside-secure - fix the invalidation step during cra_exit 2018-05-25 16:17:46 +02:00
safexcel_hash.c crypto: inside-secure - fix the invalidation step during cra_exit 2018-05-25 16:17:46 +02:00
safexcel_ring.c crypto: inside-secure - use the base_end pointer in ring rollback 2017-06-20 11:21:48 +08:00