diff options
author | Eric Biggers <ebiggers@google.com> | 2019-01-06 12:46:06 -0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-01-11 14:16:58 +0800 |
commit | 81a913cde2c709d8322ae09a81d7064200ea56a9 (patch) | |
tree | 5064647fbc34de748db88011d73e34523dc815f0 /crypto | |
parent | 3937ac55f49305e0166a9059236951e06ec756fd (diff) | |
download | linux-crypto-81a913cde2c709d8322ae09a81d7064200ea56a9.tar.gz linux-crypto-81a913cde2c709d8322ae09a81d7064200ea56a9.zip |
crypto: algapi - reject NULL crypto_spawn::inst
It took me a while to notice the bug where the adiantum template left
crypto_spawn::inst == NULL, because this only caused problems in certain
cases where algorithms are dynamically loaded/unloaded.
More improvements are needed, but for now make crypto_init_spawn()
reject this case and WARN(), so this type of bug will be noticed
immediately in the future.
Note: I checked all callers and the adiantum template was the only place
that had this wrong. So this WARN shouldn't trigger anymore.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/algapi.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index f3d76631..713baabe 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -608,6 +608,9 @@ int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, { int err = -EAGAIN; + if (WARN_ON_ONCE(inst == NULL)) + return -EINVAL; + spawn->inst = inst; spawn->mask = mask; |