From 379520ee87b92c51f1db1e5c19379d738a7c207a Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 2 Feb 2017 12:57:48 -0900 Subject: [PATCH] Fix initialization order bug --- include/linux/module.h | 2 +- linux/crypto/sha1_generic.c | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index 3d988c18..812aa350 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -9,7 +9,7 @@ struct module; #define module_init(initfn) \ - __attribute__((constructor(109))) \ + __attribute__((constructor(120))) \ static void __call_##initfn(void) { BUG_ON(initfn()); } #if 0 diff --git a/linux/crypto/sha1_generic.c b/linux/crypto/sha1_generic.c index b0b9cd15..31b5d12e 100644 --- a/linux/crypto/sha1_generic.c +++ b/linux/crypto/sha1_generic.c @@ -78,15 +78,8 @@ static struct shash_alg alg = { } }; +__attribute__((constructor(110))) static int __init sha1_generic_mod_init(void) { return crypto_register_shash(&alg); } - -static void __exit sha1_generic_mod_fini(void) -{ - crypto_unregister_shash(&alg); -} - -module_init(sha1_generic_mod_init); -module_exit(sha1_generic_mod_fini);