mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
crypto: drbg - fix error return code in drbg_alloc_state()
commit e0664ebcea6ac5e16da703409fb4bd61f8cd37d9 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 <[email protected]>
Fixes: db07cd26ac ("crypto: drbg - add FIPS 140-2 CTRNG for noise source")
Cc: <[email protected]>
Signed-off-by: Wei Yongjun <[email protected]>
Reviewed-by: Stephan Mueller <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
6ebdf342d4
commit
977b89e1ab
1 changed files with 3 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue