diff options
Diffstat (limited to 'security')
-rw-r--r-- | security/keys/user_defined.c | 16 | ||||
-rw-r--r-- | security/selinux/avc.c | 15 | ||||
-rw-r--r-- | security/selinux/hooks.c | 3 | ||||
-rw-r--r-- | security/selinux/include/avc.h | 1 | ||||
-rw-r--r-- | security/selinux/netif.c | 18 | ||||
-rw-r--r-- | security/selinux/selinuxfs.c | 10 | ||||
-rw-r--r-- | security/selinux/ss/policydb.c | 10 |
7 files changed, 20 insertions, 53 deletions
diff --git a/security/keys/user_defined.c b/security/keys/user_defined.c index c6ca8662a468..f66baf44f32d 100644 --- a/security/keys/user_defined.c +++ b/security/keys/user_defined.c | |||
@@ -69,18 +69,6 @@ error: | |||
69 | EXPORT_SYMBOL_GPL(user_instantiate); | 69 | EXPORT_SYMBOL_GPL(user_instantiate); |
70 | 70 | ||
71 | /* | 71 | /* |
72 | * dispose of the old data from an updated user defined key | ||
73 | */ | ||
74 | static void user_update_rcu_disposal(struct rcu_head *rcu) | ||
75 | { | ||
76 | struct user_key_payload *upayload; | ||
77 | |||
78 | upayload = container_of(rcu, struct user_key_payload, rcu); | ||
79 | |||
80 | kfree(upayload); | ||
81 | } | ||
82 | |||
83 | /* | ||
84 | * update a user defined key | 72 | * update a user defined key |
85 | * - the key's semaphore is write-locked | 73 | * - the key's semaphore is write-locked |
86 | */ | 74 | */ |
@@ -114,7 +102,7 @@ int user_update(struct key *key, const void *data, size_t datalen) | |||
114 | key->expiry = 0; | 102 | key->expiry = 0; |
115 | } | 103 | } |
116 | 104 | ||
117 | call_rcu(&zap->rcu, user_update_rcu_disposal); | 105 | kfree_rcu(zap, rcu); |
118 | 106 | ||
119 | error: | 107 | error: |
120 | return ret; | 108 | return ret; |
@@ -145,7 +133,7 @@ void user_revoke(struct key *key) | |||
145 | 133 | ||
146 | if (upayload) { | 134 | if (upayload) { |
147 | rcu_assign_pointer(key->payload.data, NULL); | 135 | rcu_assign_pointer(key->payload.data, NULL); |
148 | call_rcu(&upayload->rcu, user_update_rcu_disposal); | 136 | kfree_rcu(upayload, rcu); |
149 | } | 137 | } |
150 | } | 138 | } |
151 | 139 | ||
diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 1d027e29ce8d..3d2715fd35ea 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c | |||
@@ -38,11 +38,7 @@ | |||
38 | #define AVC_CACHE_RECLAIM 16 | 38 | #define AVC_CACHE_RECLAIM 16 |
39 | 39 | ||
40 | #ifdef CONFIG_SECURITY_SELINUX_AVC_STATS | 40 | #ifdef CONFIG_SECURITY_SELINUX_AVC_STATS |
41 | #define avc_cache_stats_incr(field) \ | 41 | #define avc_cache_stats_incr(field) this_cpu_inc(avc_cache_stats.field) |
42 | do { \ | ||
43 | per_cpu(avc_cache_stats, get_cpu()).field++; \ | ||
44 | put_cpu(); \ | ||
45 | } while (0) | ||
46 | #else | 42 | #else |
47 | #define avc_cache_stats_incr(field) do {} while (0) | 43 | #define avc_cache_stats_incr(field) do {} while (0) |
48 | #endif | 44 | #endif |
@@ -347,11 +343,10 @@ static struct avc_node *avc_lookup(u32 ssid, u32 tsid, u16 tclass) | |||
347 | node = avc_search_node(ssid, tsid, tclass); | 343 | node = avc_search_node(ssid, tsid, tclass); |
348 | 344 | ||
349 | if (node) | 345 | if (node) |
350 | avc_cache_stats_incr(hits); | 346 | return node; |
351 | else | ||
352 | avc_cache_stats_incr(misses); | ||
353 | 347 | ||
354 | return node; | 348 | avc_cache_stats_incr(misses); |
349 | return NULL; | ||
355 | } | 350 | } |
356 | 351 | ||
357 | static int avc_latest_notif_update(int seqno, int is_insert) | 352 | static int avc_latest_notif_update(int seqno, int is_insert) |
@@ -769,7 +764,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, | |||
769 | rcu_read_lock(); | 764 | rcu_read_lock(); |
770 | 765 | ||
771 | node = avc_lookup(ssid, tsid, tclass); | 766 | node = avc_lookup(ssid, tsid, tclass); |
772 | if (!node) { | 767 | if (unlikely(!node)) { |
773 | rcu_read_unlock(); | 768 | rcu_read_unlock(); |
774 | 769 | ||
775 | if (in_avd) | 770 | if (in_avd) |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index f7cf0ea6faea..8fb248843009 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1578,7 +1578,8 @@ static int may_create(struct inode *dir, | |||
1578 | return rc; | 1578 | return rc; |
1579 | 1579 | ||
1580 | if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) { | 1580 | if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) { |
1581 | rc = security_transition_sid(sid, dsec->sid, tclass, NULL, &newsid); | 1581 | rc = security_transition_sid(sid, dsec->sid, tclass, |
1582 | &dentry->d_name, &newsid); | ||
1582 | if (rc) | 1583 | if (rc) |
1583 | return rc; | 1584 | return rc; |
1584 | } | 1585 | } |
diff --git a/security/selinux/include/avc.h b/security/selinux/include/avc.h index e77b2ac2908b..47fda963495d 100644 --- a/security/selinux/include/avc.h +++ b/security/selinux/include/avc.h | |||
@@ -41,7 +41,6 @@ struct sk_buff; | |||
41 | */ | 41 | */ |
42 | struct avc_cache_stats { | 42 | struct avc_cache_stats { |
43 | unsigned int lookups; | 43 | unsigned int lookups; |
44 | unsigned int hits; | ||
45 | unsigned int misses; | 44 | unsigned int misses; |
46 | unsigned int allocations; | 45 | unsigned int allocations; |
47 | unsigned int reclaims; | 46 | unsigned int reclaims; |
diff --git a/security/selinux/netif.c b/security/selinux/netif.c index d6095d63d831..58cc481c93d5 100644 --- a/security/selinux/netif.c +++ b/security/selinux/netif.c | |||
@@ -104,22 +104,6 @@ static int sel_netif_insert(struct sel_netif *netif) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * sel_netif_free - Frees an interface entry | ||
108 | * @p: the entry's RCU field | ||
109 | * | ||
110 | * Description: | ||
111 | * This function is designed to be used as a callback to the call_rcu() | ||
112 | * function so that memory allocated to a hash table interface entry can be | ||
113 | * released safely. | ||
114 | * | ||
115 | */ | ||
116 | static void sel_netif_free(struct rcu_head *p) | ||
117 | { | ||
118 | struct sel_netif *netif = container_of(p, struct sel_netif, rcu_head); | ||
119 | kfree(netif); | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * sel_netif_destroy - Remove an interface record from the table | 107 | * sel_netif_destroy - Remove an interface record from the table |
124 | * @netif: the existing interface record | 108 | * @netif: the existing interface record |
125 | * | 109 | * |
@@ -131,7 +115,7 @@ static void sel_netif_destroy(struct sel_netif *netif) | |||
131 | { | 115 | { |
132 | list_del_rcu(&netif->list); | 116 | list_del_rcu(&netif->list); |
133 | sel_netif_total--; | 117 | sel_netif_total--; |
134 | call_rcu(&netif->rcu_head, sel_netif_free); | 118 | kfree_rcu(netif, rcu_head); |
135 | } | 119 | } |
136 | 120 | ||
137 | /** | 121 | /** |
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 47b7d624a6e1..2d3373b2e256 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -1380,10 +1380,14 @@ static int sel_avc_stats_seq_show(struct seq_file *seq, void *v) | |||
1380 | if (v == SEQ_START_TOKEN) | 1380 | if (v == SEQ_START_TOKEN) |
1381 | seq_printf(seq, "lookups hits misses allocations reclaims " | 1381 | seq_printf(seq, "lookups hits misses allocations reclaims " |
1382 | "frees\n"); | 1382 | "frees\n"); |
1383 | else | 1383 | else { |
1384 | seq_printf(seq, "%u %u %u %u %u %u\n", st->lookups, | 1384 | unsigned int lookups = st->lookups; |
1385 | st->hits, st->misses, st->allocations, | 1385 | unsigned int misses = st->misses; |
1386 | unsigned int hits = lookups - misses; | ||
1387 | seq_printf(seq, "%u %u %u %u %u %u\n", lookups, | ||
1388 | hits, misses, st->allocations, | ||
1386 | st->reclaims, st->frees); | 1389 | st->reclaims, st->frees); |
1390 | } | ||
1387 | return 0; | 1391 | return 0; |
1388 | } | 1392 | } |
1389 | 1393 | ||
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index e7b850ad57ee..7102457661d6 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c | |||
@@ -502,7 +502,7 @@ static int policydb_index(struct policydb *p) | |||
502 | goto out; | 502 | goto out; |
503 | 503 | ||
504 | rc = flex_array_prealloc(p->type_val_to_struct_array, 0, | 504 | rc = flex_array_prealloc(p->type_val_to_struct_array, 0, |
505 | p->p_types.nprim - 1, GFP_KERNEL | __GFP_ZERO); | 505 | p->p_types.nprim, GFP_KERNEL | __GFP_ZERO); |
506 | if (rc) | 506 | if (rc) |
507 | goto out; | 507 | goto out; |
508 | 508 | ||
@@ -519,7 +519,7 @@ static int policydb_index(struct policydb *p) | |||
519 | goto out; | 519 | goto out; |
520 | 520 | ||
521 | rc = flex_array_prealloc(p->sym_val_to_name[i], | 521 | rc = flex_array_prealloc(p->sym_val_to_name[i], |
522 | 0, p->symtab[i].nprim - 1, | 522 | 0, p->symtab[i].nprim, |
523 | GFP_KERNEL | __GFP_ZERO); | 523 | GFP_KERNEL | __GFP_ZERO); |
524 | if (rc) | 524 | if (rc) |
525 | goto out; | 525 | goto out; |
@@ -1819,8 +1819,6 @@ static int filename_trans_read(struct policydb *p, void *fp) | |||
1819 | goto out; | 1819 | goto out; |
1820 | nel = le32_to_cpu(buf[0]); | 1820 | nel = le32_to_cpu(buf[0]); |
1821 | 1821 | ||
1822 | printk(KERN_ERR "%s: nel=%d\n", __func__, nel); | ||
1823 | |||
1824 | last = p->filename_trans; | 1822 | last = p->filename_trans; |
1825 | while (last && last->next) | 1823 | while (last && last->next) |
1826 | last = last->next; | 1824 | last = last->next; |
@@ -1857,8 +1855,6 @@ static int filename_trans_read(struct policydb *p, void *fp) | |||
1857 | goto out; | 1855 | goto out; |
1858 | name[len] = 0; | 1856 | name[len] = 0; |
1859 | 1857 | ||
1860 | printk(KERN_ERR "%s: ft=%p ft->name=%p ft->name=%s\n", __func__, ft, ft->name, ft->name); | ||
1861 | |||
1862 | rc = next_entry(buf, fp, sizeof(u32) * 4); | 1858 | rc = next_entry(buf, fp, sizeof(u32) * 4); |
1863 | if (rc) | 1859 | if (rc) |
1864 | goto out; | 1860 | goto out; |
@@ -2375,7 +2371,7 @@ int policydb_read(struct policydb *p, void *fp) | |||
2375 | goto bad; | 2371 | goto bad; |
2376 | 2372 | ||
2377 | /* preallocate so we don't have to worry about the put ever failing */ | 2373 | /* preallocate so we don't have to worry about the put ever failing */ |
2378 | rc = flex_array_prealloc(p->type_attr_map_array, 0, p->p_types.nprim - 1, | 2374 | rc = flex_array_prealloc(p->type_attr_map_array, 0, p->p_types.nprim, |
2379 | GFP_KERNEL | __GFP_ZERO); | 2375 | GFP_KERNEL | __GFP_ZERO); |
2380 | if (rc) | 2376 | if (rc) |
2381 | goto bad; | 2377 | goto bad; |