Skip to contentSkip to conversation

slim: handle failure to register

PATCH New Kylene Jo Hall 1 participant 1 message Sep 20, 2006 Security (LSM)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 slim: handle failure to register

Thanks to Stephen Smalley for pointing out that we need to securely handle a failure to register with the LSM security hooks. This patch adds a panic in the event that the module is unable to register.

---
security/slim/slm_main.c | 6 +++++-

1 files changed, 5 insertions(+), 1 deletion(-) 
security/slim/slm_main.c +5 -1
@@ -1644,9 +1644,13 @@ int slim_enabled = 1;
 #endif
 static int __init init_slm(void)
 {
+	int rc;
 	if (!slim_enabled)
 		return 0;
 	slm_task_init_alloc_security(current);
-	return register_security(&slm_security_ops);
+	rc = register_security(&slm_security_ops);
+	if (rc != 0)
+		panic("SLIM: Unable to register with kernel\n");
+	return rc;
 }
 security_initcall(init_slm);