diff options
Diffstat (limited to 'security/security.c')
-rw-r--r-- | security/security.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/security/security.c b/security/security.c index c53949f17d9e..1b798d3df710 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -89,20 +89,12 @@ __setup("security=", choose_lsm); | |||
89 | * Return true if: | 89 | * Return true if: |
90 | * -The passed LSM is the one chosen by user at boot time, | 90 | * -The passed LSM is the one chosen by user at boot time, |
91 | * -or the passed LSM is configured as the default and the user did not | 91 | * -or the passed LSM is configured as the default and the user did not |
92 | * choose an alternate LSM at boot time, | 92 | * choose an alternate LSM at boot time. |
93 | * -or there is no default LSM set and the user didn't specify a | ||
94 | * specific LSM and we're the first to ask for registration permission, | ||
95 | * -or the passed LSM is currently loaded. | ||
96 | * Otherwise, return false. | 93 | * Otherwise, return false. |
97 | */ | 94 | */ |
98 | int __init security_module_enable(struct security_operations *ops) | 95 | int __init security_module_enable(struct security_operations *ops) |
99 | { | 96 | { |
100 | if (!*chosen_lsm) | 97 | return !strcmp(ops->name, chosen_lsm); |
101 | strncpy(chosen_lsm, ops->name, SECURITY_NAME_MAX); | ||
102 | else if (strncmp(ops->name, chosen_lsm, SECURITY_NAME_MAX)) | ||
103 | return 0; | ||
104 | |||
105 | return 1; | ||
106 | } | 98 | } |
107 | 99 | ||
108 | /** | 100 | /** |
@@ -205,9 +197,9 @@ int security_quota_on(struct dentry *dentry) | |||
205 | return security_ops->quota_on(dentry); | 197 | return security_ops->quota_on(dentry); |
206 | } | 198 | } |
207 | 199 | ||
208 | int security_syslog(int type, bool from_file) | 200 | int security_syslog(int type) |
209 | { | 201 | { |
210 | return security_ops->syslog(type, from_file); | 202 | return security_ops->syslog(type); |
211 | } | 203 | } |
212 | 204 | ||
213 | int security_settime(struct timespec *ts, struct timezone *tz) | 205 | int security_settime(struct timespec *ts, struct timezone *tz) |
@@ -333,16 +325,8 @@ EXPORT_SYMBOL(security_sb_parse_opts_str); | |||
333 | 325 | ||
334 | int security_inode_alloc(struct inode *inode) | 326 | int security_inode_alloc(struct inode *inode) |
335 | { | 327 | { |
336 | int ret; | ||
337 | |||
338 | inode->i_security = NULL; | 328 | inode->i_security = NULL; |
339 | ret = security_ops->inode_alloc_security(inode); | 329 | return security_ops->inode_alloc_security(inode); |
340 | if (ret) | ||
341 | return ret; | ||
342 | ret = ima_inode_alloc(inode); | ||
343 | if (ret) | ||
344 | security_inode_free(inode); | ||
345 | return ret; | ||
346 | } | 330 | } |
347 | 331 | ||
348 | void security_inode_free(struct inode *inode) | 332 | void security_inode_free(struct inode *inode) |
@@ -786,10 +770,9 @@ int security_task_setrlimit(struct task_struct *p, unsigned int resource, | |||
786 | return security_ops->task_setrlimit(p, resource, new_rlim); | 770 | return security_ops->task_setrlimit(p, resource, new_rlim); |
787 | } | 771 | } |
788 | 772 | ||
789 | int security_task_setscheduler(struct task_struct *p, | 773 | int security_task_setscheduler(struct task_struct *p) |
790 | int policy, struct sched_param *lp) | ||
791 | { | 774 | { |
792 | return security_ops->task_setscheduler(p, policy, lp); | 775 | return security_ops->task_setscheduler(p); |
793 | } | 776 | } |
794 | 777 | ||
795 | int security_task_getscheduler(struct task_struct *p) | 778 | int security_task_getscheduler(struct task_struct *p) |
@@ -1145,6 +1128,24 @@ void security_inet_conn_established(struct sock *sk, | |||
1145 | security_ops->inet_conn_established(sk, skb); | 1128 | security_ops->inet_conn_established(sk, skb); |
1146 | } | 1129 | } |
1147 | 1130 | ||
1131 | int security_secmark_relabel_packet(u32 secid) | ||
1132 | { | ||
1133 | return security_ops->secmark_relabel_packet(secid); | ||
1134 | } | ||
1135 | EXPORT_SYMBOL(security_secmark_relabel_packet); | ||
1136 | |||
1137 | void security_secmark_refcount_inc(void) | ||
1138 | { | ||
1139 | security_ops->secmark_refcount_inc(); | ||
1140 | } | ||
1141 | EXPORT_SYMBOL(security_secmark_refcount_inc); | ||
1142 | |||
1143 | void security_secmark_refcount_dec(void) | ||
1144 | { | ||
1145 | security_ops->secmark_refcount_dec(); | ||
1146 | } | ||
1147 | EXPORT_SYMBOL(security_secmark_refcount_dec); | ||
1148 | |||
1148 | int security_tun_dev_create(void) | 1149 | int security_tun_dev_create(void) |
1149 | { | 1150 | { |
1150 | return security_ops->tun_dev_create(); | 1151 | return security_ops->tun_dev_create(); |