xref: /linux/security/selinux/initcalls.c (revision a619fe35ab41fded440d3762d4fbad84ff86a4d4)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * SELinux initcalls
4  */
5 
6 #include <linux/init.h>
7 
8 #include "initcalls.h"
9 
10 /**
11  * selinux_initcall - Perform the SELinux initcalls
12  *
13  * Used as a device initcall in the SELinux LSM definition.
14  */
15 int __init selinux_initcall(void)
16 {
17 	int rc = 0, rc_tmp = 0;
18 
19 	rc_tmp = init_sel_fs();
20 	if (!rc && rc_tmp)
21 		rc = rc_tmp;
22 
23 	rc_tmp = sel_netport_init();
24 	if (!rc && rc_tmp)
25 		rc = rc_tmp;
26 
27 	rc_tmp = sel_netnode_init();
28 	if (!rc && rc_tmp)
29 		rc = rc_tmp;
30 
31 	rc_tmp = sel_netif_init();
32 	if (!rc && rc_tmp)
33 		rc = rc_tmp;
34 
35 	rc_tmp = sel_netlink_init();
36 	if (!rc && rc_tmp)
37 		rc = rc_tmp;
38 
39 #if defined(CONFIG_SECURITY_INFINIBAND)
40 	rc_tmp = sel_ib_pkey_init();
41 	if (!rc && rc_tmp)
42 		rc = rc_tmp;
43 #endif
44 
45 #if defined(CONFIG_NETFILTER)
46 	rc_tmp = selinux_nf_ip_init();
47 	if (!rc && rc_tmp)
48 		rc = rc_tmp;
49 #endif
50 
51 	return rc;
52 }
53