netnode.c (73073d956a2073554b99d621a7a7ec9437055044) netnode.c (0e326df069802dc48e4f095f889cb780e4beaba6)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Network node table
4 *
5 * SELinux must keep a mapping of network nodes to labels/SIDs. This
6 * mapping is maintained as part of the normal policy but a fast cache is
7 * needed to reduce the lookup overhead since most of these queries happen on
8 * a per-packet basis.

--- 150 unchanged lines hidden (view full) ---

159 }
160
161 /* we need to impose a limit on the growth of the hash table so check
162 * this bucket to make sure it is within the specified bounds */
163 list_add_rcu(&node->list, &sel_netnode_hash[idx].list);
164 if (sel_netnode_hash[idx].size == SEL_NETNODE_HASH_BKT_LIMIT) {
165 struct sel_netnode *tail;
166 tail = list_entry(
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Network node table
4 *
5 * SELinux must keep a mapping of network nodes to labels/SIDs. This
6 * mapping is maintained as part of the normal policy but a fast cache is
7 * needed to reduce the lookup overhead since most of these queries happen on
8 * a per-packet basis.

--- 150 unchanged lines hidden (view full) ---

159 }
160
161 /* we need to impose a limit on the growth of the hash table so check
162 * this bucket to make sure it is within the specified bounds */
163 list_add_rcu(&node->list, &sel_netnode_hash[idx].list);
164 if (sel_netnode_hash[idx].size == SEL_NETNODE_HASH_BKT_LIMIT) {
165 struct sel_netnode *tail;
166 tail = list_entry(
167 rcu_dereference_protected(sel_netnode_hash[idx].list.prev,
168 lockdep_is_held(&sel_netnode_lock)),
167 rcu_dereference_protected(
168 list_tail_rcu(&sel_netnode_hash[idx].list),
169 lockdep_is_held(&sel_netnode_lock)),
169 struct sel_netnode, list);
170 list_del_rcu(&tail->list);
171 kfree_rcu(tail, rcu);
172 } else
173 sel_netnode_hash[idx].size++;
174}
175
176/**

--- 128 unchanged lines hidden ---
170 struct sel_netnode, list);
171 list_del_rcu(&tail->list);
172 kfree_rcu(tail, rcu);
173 } else
174 sel_netnode_hash[idx].size++;
175}
176
177/**

--- 128 unchanged lines hidden ---