Skip to content

Commit b62755a

Browse files
ebiggersherbertx
authored andcommitted
crypto: x86/chacha - only unregister algorithms if registered
It's not valid to call crypto_unregister_skciphers() without a prior call to crypto_register_skciphers(). Fixes: 84e03fa ("crypto: x86/chacha - expose SIMD ChaCha routine as library function") Signed-off-by: Eric Biggers <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 2043323 commit b62755a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/crypto/chacha_glue.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ static int __init chacha_simd_mod_init(void)
304304

305305
static void __exit chacha_simd_mod_fini(void)
306306
{
307-
crypto_unregister_skciphers(algs, ARRAY_SIZE(algs));
307+
if (boot_cpu_has(X86_FEATURE_SSSE3))
308+
crypto_unregister_skciphers(algs, ARRAY_SIZE(algs));
308309
}
309310

310311
module_init(chacha_simd_mod_init);

0 commit comments

Comments
 (0)