diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2020-04-30 08:13:53 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-06-17 16:40:31 +0200 |
commit | d448489e03a53a86a6c5c0fc4c0a282b3874e455 (patch) | |
tree | 4f36853dcd574c910fa8114ab517bc6da4287b95 /crypto/drbg.c | |
parent | 8f31cbed0b62fd2e37e4fb9f1b1921a8761fb62f (diff) | |
download | linux-crypto-d448489e03a53a86a6c5c0fc4c0a282b3874e455.tar.gz linux-crypto-d448489e03a53a86a6c5c0fc4c0a282b3874e455.zip |
crypto: drbg - fix error return code in drbg_alloc_state()
commit 4e74a113fa130f456485cc3f2460ca743aadf8aa upstream.
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: 384577283cad ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to '')
-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 b6929eb5..04379ca6 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -1294,8 +1294,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; } |