diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2020-04-30 10:13:53 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2020-05-08 07:30:41 +0200 |
commit | e0664ebcea6ac5e16da703409fb4bd61f8cd37d9 (patch) | |
tree | 69c363f2886a5031edd8a61ebf04884dd5f6a438 | |
parent | crypto: acomp - search acomp with scomp backend in crypto_has_acomp (diff) | |
download | linux-e0664ebcea6ac5e16da703409fb4bd61f8cd37d9.tar.xz linux-e0664ebcea6ac5e16da703409fb4bd61f8cd37d9.zip |
crypto: drbg - fix error return code in drbg_alloc_state()
Fix to return negative error code -ENOMEM from the kzalloc error handling
case instead of 0, as done elsewhere in this function.
Reported-by: Xiumei Mu <xmu@redhat.com>
Fixes: db07cd26ac6a ("crypto: drbg - add FIPS 140-2 CTRNG for noise source")
Cc: <stable@vger.kernel.org>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/drbg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c index e57901d8545b..37526eb8c5d5 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -1306,8 +1306,10 @@ static inline int drbg_alloc_state(struct drbg_state *drbg) if (IS_ENABLED(CONFIG_CRYPTO_FIPS)) { drbg->prev = kzalloc(drbg_sec_strength(drbg->core->flags), GFP_KERNEL); - if (!drbg->prev) + if (!drbg->prev) { + ret = -ENOMEM; goto fini; + } drbg->fips_primed = false; } |