diff options
Diffstat (limited to 'security/selinux/avc.c')
-rw-r--r-- | security/selinux/avc.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 4d3fab47e643..dad36a6ab45f 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c | |||
@@ -188,11 +188,9 @@ int avc_get_hash_stats(char *page) | |||
188 | for (i = 0; i < AVC_CACHE_SLOTS; i++) { | 188 | for (i = 0; i < AVC_CACHE_SLOTS; i++) { |
189 | head = &avc_cache.slots[i]; | 189 | head = &avc_cache.slots[i]; |
190 | if (!hlist_empty(head)) { | 190 | if (!hlist_empty(head)) { |
191 | struct hlist_node *next; | ||
192 | |||
193 | slots_used++; | 191 | slots_used++; |
194 | chain_len = 0; | 192 | chain_len = 0; |
195 | hlist_for_each_entry_rcu(node, next, head, list) | 193 | hlist_for_each_entry_rcu(node, head, list) |
196 | chain_len++; | 194 | chain_len++; |
197 | if (chain_len > max_chain_len) | 195 | if (chain_len > max_chain_len) |
198 | max_chain_len = chain_len; | 196 | max_chain_len = chain_len; |
@@ -241,7 +239,6 @@ static inline int avc_reclaim_node(void) | |||
241 | int hvalue, try, ecx; | 239 | int hvalue, try, ecx; |
242 | unsigned long flags; | 240 | unsigned long flags; |
243 | struct hlist_head *head; | 241 | struct hlist_head *head; |
244 | struct hlist_node *next; | ||
245 | spinlock_t *lock; | 242 | spinlock_t *lock; |
246 | 243 | ||
247 | for (try = 0, ecx = 0; try < AVC_CACHE_SLOTS; try++) { | 244 | for (try = 0, ecx = 0; try < AVC_CACHE_SLOTS; try++) { |
@@ -253,7 +250,7 @@ static inline int avc_reclaim_node(void) | |||
253 | continue; | 250 | continue; |
254 | 251 | ||
255 | rcu_read_lock(); | 252 | rcu_read_lock(); |
256 | hlist_for_each_entry(node, next, head, list) { | 253 | hlist_for_each_entry(node, head, list) { |
257 | avc_node_delete(node); | 254 | avc_node_delete(node); |
258 | avc_cache_stats_incr(reclaims); | 255 | avc_cache_stats_incr(reclaims); |
259 | ecx++; | 256 | ecx++; |
@@ -301,11 +298,10 @@ static inline struct avc_node *avc_search_node(u32 ssid, u32 tsid, u16 tclass) | |||
301 | struct avc_node *node, *ret = NULL; | 298 | struct avc_node *node, *ret = NULL; |
302 | int hvalue; | 299 | int hvalue; |
303 | struct hlist_head *head; | 300 | struct hlist_head *head; |
304 | struct hlist_node *next; | ||
305 | 301 | ||
306 | hvalue = avc_hash(ssid, tsid, tclass); | 302 | hvalue = avc_hash(ssid, tsid, tclass); |
307 | head = &avc_cache.slots[hvalue]; | 303 | head = &avc_cache.slots[hvalue]; |
308 | hlist_for_each_entry_rcu(node, next, head, list) { | 304 | hlist_for_each_entry_rcu(node, head, list) { |
309 | if (ssid == node->ae.ssid && | 305 | if (ssid == node->ae.ssid && |
310 | tclass == node->ae.tclass && | 306 | tclass == node->ae.tclass && |
311 | tsid == node->ae.tsid) { | 307 | tsid == node->ae.tsid) { |
@@ -394,7 +390,6 @@ static struct avc_node *avc_insert(u32 ssid, u32 tsid, u16 tclass, struct av_dec | |||
394 | node = avc_alloc_node(); | 390 | node = avc_alloc_node(); |
395 | if (node) { | 391 | if (node) { |
396 | struct hlist_head *head; | 392 | struct hlist_head *head; |
397 | struct hlist_node *next; | ||
398 | spinlock_t *lock; | 393 | spinlock_t *lock; |
399 | 394 | ||
400 | hvalue = avc_hash(ssid, tsid, tclass); | 395 | hvalue = avc_hash(ssid, tsid, tclass); |
@@ -404,7 +399,7 @@ static struct avc_node *avc_insert(u32 ssid, u32 tsid, u16 tclass, struct av_dec | |||
404 | lock = &avc_cache.slots_lock[hvalue]; | 399 | lock = &avc_cache.slots_lock[hvalue]; |
405 | 400 | ||
406 | spin_lock_irqsave(lock, flag); | 401 | spin_lock_irqsave(lock, flag); |
407 | hlist_for_each_entry(pos, next, head, list) { | 402 | hlist_for_each_entry(pos, head, list) { |
408 | if (pos->ae.ssid == ssid && | 403 | if (pos->ae.ssid == ssid && |
409 | pos->ae.tsid == tsid && | 404 | pos->ae.tsid == tsid && |
410 | pos->ae.tclass == tclass) { | 405 | pos->ae.tclass == tclass) { |
@@ -541,7 +536,6 @@ static int avc_update_node(u32 event, u32 perms, u32 ssid, u32 tsid, u16 tclass, | |||
541 | unsigned long flag; | 536 | unsigned long flag; |
542 | struct avc_node *pos, *node, *orig = NULL; | 537 | struct avc_node *pos, *node, *orig = NULL; |
543 | struct hlist_head *head; | 538 | struct hlist_head *head; |
544 | struct hlist_node *next; | ||
545 | spinlock_t *lock; | 539 | spinlock_t *lock; |
546 | 540 | ||
547 | node = avc_alloc_node(); | 541 | node = avc_alloc_node(); |
@@ -558,7 +552,7 @@ static int avc_update_node(u32 event, u32 perms, u32 ssid, u32 tsid, u16 tclass, | |||
558 | 552 | ||
559 | spin_lock_irqsave(lock, flag); | 553 | spin_lock_irqsave(lock, flag); |
560 | 554 | ||
561 | hlist_for_each_entry(pos, next, head, list) { | 555 | hlist_for_each_entry(pos, head, list) { |
562 | if (ssid == pos->ae.ssid && | 556 | if (ssid == pos->ae.ssid && |
563 | tsid == pos->ae.tsid && | 557 | tsid == pos->ae.tsid && |
564 | tclass == pos->ae.tclass && | 558 | tclass == pos->ae.tclass && |
@@ -614,7 +608,6 @@ out: | |||
614 | static void avc_flush(void) | 608 | static void avc_flush(void) |
615 | { | 609 | { |
616 | struct hlist_head *head; | 610 | struct hlist_head *head; |
617 | struct hlist_node *next; | ||
618 | struct avc_node *node; | 611 | struct avc_node *node; |
619 | spinlock_t *lock; | 612 | spinlock_t *lock; |
620 | unsigned long flag; | 613 | unsigned long flag; |
@@ -630,7 +623,7 @@ static void avc_flush(void) | |||
630 | * prevent RCU grace periods from ending. | 623 | * prevent RCU grace periods from ending. |
631 | */ | 624 | */ |
632 | rcu_read_lock(); | 625 | rcu_read_lock(); |
633 | hlist_for_each_entry(node, next, head, list) | 626 | hlist_for_each_entry(node, head, list) |
634 | avc_node_delete(node); | 627 | avc_node_delete(node); |
635 | rcu_read_unlock(); | 628 | rcu_read_unlock(); |
636 | spin_unlock_irqrestore(lock, flag); | 629 | spin_unlock_irqrestore(lock, flag); |