aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/conditional.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-03 11:50:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-03 11:50:52 -0400
commit0302e28dee643932ee7b3c112ebccdbb9f8ec32c (patch)
tree405d4cb3f772ef069ed7f291adc4b74a4e73346e /security/selinux/ss/conditional.c
parent89c9fea3c8034cdb2fd745f551cde0b507fd6893 (diff)
parent8979b02aaf1d6de8d52cc143aa4da961ed32e5a2 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem updates from James Morris: "Highlights: IMA: - provide ">" and "<" operators for fowner/uid/euid rules KEYS: - add a system blacklist keyring - add KEYCTL_RESTRICT_KEYRING, exposes keyring link restriction functionality to userland via keyctl() LSM: - harden LSM API with __ro_after_init - add prlmit security hook, implement for SELinux - revive security_task_alloc hook TPM: - implement contextual TPM command 'spaces'" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (98 commits) tpm: Fix reference count to main device tpm_tis: convert to using locality callbacks tpm: fix handling of the TPM 2.0 event logs tpm_crb: remove a cruft constant keys: select CONFIG_CRYPTO when selecting DH / KDF apparmor: Make path_max parameter readonly apparmor: fix parameters so that the permission test is bypassed at boot apparmor: fix invalid reference to index variable of iterator line 836 apparmor: use SHASH_DESC_ON_STACK security/apparmor/lsm.c: set debug messages apparmor: fix boolreturn.cocci warnings Smack: Use GFP_KERNEL for smk_netlbl_mls(). smack: fix double free in smack_parse_opts_str() KEYS: add SP800-56A KDF support for DH KEYS: Keyring asymmetric key restrict method with chaining KEYS: Restrict asymmetric key linkage using a specific keychain KEYS: Add a lookup_restriction function for the asymmetric key type KEYS: Add KEYCTL_RESTRICT_KEYRING KEYS: Consistent ordering for __key_link_begin and restrict check KEYS: Add an optional lookup_restriction hook to key_type ...
Diffstat (limited to 'security/selinux/ss/conditional.c')
-rw-r--r--security/selinux/ss/conditional.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
index 34afeadd9e73..771c96afe1d5 100644
--- a/security/selinux/ss/conditional.c
+++ b/security/selinux/ss/conditional.c
@@ -176,8 +176,9 @@ void cond_policydb_destroy(struct policydb *p)
176int cond_init_bool_indexes(struct policydb *p) 176int cond_init_bool_indexes(struct policydb *p)
177{ 177{
178 kfree(p->bool_val_to_struct); 178 kfree(p->bool_val_to_struct);
179 p->bool_val_to_struct = 179 p->bool_val_to_struct = kmalloc_array(p->p_bools.nprim,
180 kmalloc(p->p_bools.nprim * sizeof(struct cond_bool_datum *), GFP_KERNEL); 180 sizeof(*p->bool_val_to_struct),
181 GFP_KERNEL);
181 if (!p->bool_val_to_struct) 182 if (!p->bool_val_to_struct)
182 return -ENOMEM; 183 return -ENOMEM;
183 return 0; 184 return 0;
@@ -226,7 +227,7 @@ int cond_read_bool(struct policydb *p, struct hashtab *h, void *fp)
226 u32 len; 227 u32 len;
227 int rc; 228 int rc;
228 229
229 booldatum = kzalloc(sizeof(struct cond_bool_datum), GFP_KERNEL); 230 booldatum = kzalloc(sizeof(*booldatum), GFP_KERNEL);
230 if (!booldatum) 231 if (!booldatum)
231 return -ENOMEM; 232 return -ENOMEM;
232 233
@@ -331,7 +332,7 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
331 goto err; 332 goto err;
332 } 333 }
333 334
334 list = kzalloc(sizeof(struct cond_av_list), GFP_KERNEL); 335 list = kzalloc(sizeof(*list), GFP_KERNEL);
335 if (!list) { 336 if (!list) {
336 rc = -ENOMEM; 337 rc = -ENOMEM;
337 goto err; 338 goto err;
@@ -420,7 +421,7 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp)
420 goto err; 421 goto err;
421 422
422 rc = -ENOMEM; 423 rc = -ENOMEM;
423 expr = kzalloc(sizeof(struct cond_expr), GFP_KERNEL); 424 expr = kzalloc(sizeof(*expr), GFP_KERNEL);
424 if (!expr) 425 if (!expr)
425 goto err; 426 goto err;
426 427
@@ -471,7 +472,7 @@ int cond_read_list(struct policydb *p, void *fp)
471 472
472 for (i = 0; i < len; i++) { 473 for (i = 0; i < len; i++) {
473 rc = -ENOMEM; 474 rc = -ENOMEM;
474 node = kzalloc(sizeof(struct cond_node), GFP_KERNEL); 475 node = kzalloc(sizeof(*node), GFP_KERNEL);
475 if (!node) 476 if (!node)
476 goto err; 477 goto err;
477 478
@@ -663,5 +664,4 @@ void cond_compute_av(struct avtab *ctab, struct avtab_key *key,
663 (node->key.specified & AVTAB_XPERMS)) 664 (node->key.specified & AVTAB_XPERMS))
664 services_compute_xperms_drivers(xperms, node); 665 services_compute_xperms_drivers(xperms, node);
665 } 666 }
666 return;
667} 667}