KEYS: trusted: Avoid calling null function trusted_key_exit
Subsystems (3)
PATCH v2 1/1 KEYS: trusted: Avoid calling null function trusted_key_exit
If one loads and unloads the trusted module, trusted_key_exit can be NULL. Call it through static_call_cond() to avoid a kernel trap.
Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")
Signed-off-by Dave Kleikamp <[email protected]>
Cc Sumit Garg <[email protected]>
Cc James Bottomley <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Mimi Zohar <[email protected]>
Cc David Howells <[email protected]>
Cc James Morris <[email protected]>
Cc "Serge E. Hallyn" <[email protected]>
---
v2 changes:
Header cleanup - removed empty line and cc:stable
security/keys/trusted-keys/trusted_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/trusted-keys/trusted_core.c +1 -1
@@ -351,7 +351,7 @@ static int __init init_trusted(void) static void __exit cleanup_trusted(void) { -static_call (trusted_key_exit)(); +static_call_cond (trusted_key_exit)(); }late_initcall (init_trusted);
Signature · 1 line
2.35.0
Quoted 16 lines · Dave Kleikamp
If one loads and unloads the trusted module,
trusted_key_exitcan be NULL. Call it throughstatic_call_cond()to avoid a kernel trap.Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")Signed-off-by Dave Kleikamp <[email protected]>Cc Sumit Garg <[email protected]>Cc James Bottomley <[email protected]>Cc Jarkko Sakkinen <[email protected]>Cc Mimi Zohar <[email protected]>Cc David Howells <[email protected]>Cc James Morris <[email protected]>Cc "Serge E. Hallyn" <[email protected]>
Quoted 6 lines
---
v2 changes:
Header cleanup - removed empty line and cc:stablesecurity/keys/trusted-keys/trusted_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks for the fix.
Reviewed-by Sumit Garg <[email protected]>
-Sumit
Quoted 16 lines
security/keys/trusted-keys/trusted_core.c +1
-2@@ -351,7 +351,7 @@ static int __init init_trusted(void) static void __exit cleanup_trusted(void) { -static_call (trusted_key_exit)(); +static_call_cond (trusted_key_exit)(); }late_initcall (init_trusted); --2.35.0