netport.c (87a0b2fafc09766d8c55461a18345a1cfb10a7fe) netport.c (0e326df069802dc48e4f095f889cb780e4beaba6)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Network port table
4 *
5 * SELinux must keep a mapping of network ports 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.
8 *

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

108 /* we need to impose a limit on the growth of the hash table so check
109 * this bucket to make sure it is within the specified bounds */
110 idx = sel_netport_hashfn(port->psec.port);
111 list_add_rcu(&port->list, &sel_netport_hash[idx].list);
112 if (sel_netport_hash[idx].size == SEL_NETPORT_HASH_BKT_LIMIT) {
113 struct sel_netport *tail;
114 tail = list_entry(
115 rcu_dereference_protected(
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Network port table
4 *
5 * SELinux must keep a mapping of network ports 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.
8 *

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

108 /* we need to impose a limit on the growth of the hash table so check
109 * this bucket to make sure it is within the specified bounds */
110 idx = sel_netport_hashfn(port->psec.port);
111 list_add_rcu(&port->list, &sel_netport_hash[idx].list);
112 if (sel_netport_hash[idx].size == SEL_NETPORT_HASH_BKT_LIMIT) {
113 struct sel_netport *tail;
114 tail = list_entry(
115 rcu_dereference_protected(
116 sel_netport_hash[idx].list.prev,
116 list_tail_rcu(&sel_netport_hash[idx].list),
117 lockdep_is_held(&sel_netport_lock)),
118 struct sel_netport, list);
119 list_del_rcu(&tail->list);
120 kfree_rcu(tail, rcu);
121 } else
122 sel_netport_hash[idx].size++;
123}
124

--- 114 unchanged lines hidden ---
117 lockdep_is_held(&sel_netport_lock)),
118 struct sel_netport, list);
119 list_del_rcu(&tail->list);
120 kfree_rcu(tail, rcu);
121 } else
122 sel_netport_hash[idx].size++;
123}
124

--- 114 unchanged lines hidden ---