SELinux: use deletion-safe iterator to free list

This code is not exercised by policy version 26, but will be upon
upgrade to policy version 30.

Bug: 18087110
Change-Id: I07c6f34607713294a6a12c43a64d9936f0602200
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
This commit is contained in:
Jeff Vander Stoep 2015-04-20 17:45:42 -07:00 committed by Thierry Strudel
parent fb221ff810
commit a0504d7bde

View file

@ -306,13 +306,15 @@ static void avc_operation_decision_free(
static void avc_operation_free(struct avc_operation_node *ops_node)
{
struct avc_operation_decision_node *od_node;
struct avc_operation_decision_node *od_node, *tmp;
if (!ops_node)
return;
list_for_each_entry(od_node, &ops_node->od_head, od_list)
list_for_each_entry_safe(od_node, tmp, &ops_node->od_head, od_list) {
list_del(&od_node->od_list);
avc_operation_decision_free(od_node);
}
kmem_cache_free(avc_operation_node_cachep, ops_node);
}