ibpkey.c (d0034a7a4ac7fae708146ac0059b9c47a1543f0d) ibpkey.c (0e326df069802dc48e4f095f889cb780e4beaba6)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Pkey table
4 *
5 * SELinux must keep a mapping of Infinband PKEYs 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 *

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

99 */
100 idx = sel_ib_pkey_hashfn(pkey->psec.pkey);
101 list_add_rcu(&pkey->list, &sel_ib_pkey_hash[idx].list);
102 if (sel_ib_pkey_hash[idx].size == SEL_PKEY_HASH_BKT_LIMIT) {
103 struct sel_ib_pkey *tail;
104
105 tail = list_entry(
106 rcu_dereference_protected(
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Pkey table
4 *
5 * SELinux must keep a mapping of Infinband PKEYs 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 *

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

99 */
100 idx = sel_ib_pkey_hashfn(pkey->psec.pkey);
101 list_add_rcu(&pkey->list, &sel_ib_pkey_hash[idx].list);
102 if (sel_ib_pkey_hash[idx].size == SEL_PKEY_HASH_BKT_LIMIT) {
103 struct sel_ib_pkey *tail;
104
105 tail = list_entry(
106 rcu_dereference_protected(
107 sel_ib_pkey_hash[idx].list.prev,
107 list_tail_rcu(&sel_ib_pkey_hash[idx].list),
108 lockdep_is_held(&sel_ib_pkey_lock)),
109 struct sel_ib_pkey, list);
110 list_del_rcu(&tail->list);
111 kfree_rcu(tail, rcu);
112 } else {
113 sel_ib_pkey_hash[idx].size++;
114 }
115}

--- 122 unchanged lines hidden ---
108 lockdep_is_held(&sel_ib_pkey_lock)),
109 struct sel_ib_pkey, list);
110 list_del_rcu(&tail->list);
111 kfree_rcu(tail, rcu);
112 } else {
113 sel_ib_pkey_hash[idx].size++;
114 }
115}

--- 122 unchanged lines hidden ---