Linux 6.9-rc4
[sfrench/cifs-2.6.git] / security / selinux / netport.c
index d340f4dcdf5f01990437e4ef3614ec2b7f13d77f..2e22ad9c2bd0d116668985e0fb579b5934df9394 100644 (file)
@@ -53,7 +53,6 @@ struct sel_netport {
  * if this becomes a problem we can always add a hash table for each address
  * family later */
 
-static LIST_HEAD(sel_netport_list);
 static DEFINE_SPINLOCK(sel_netport_lock);
 static struct sel_netport_bkt sel_netport_hash[SEL_NETPORT_HASH_SIZE];
 
@@ -74,7 +73,7 @@ static unsigned int sel_netport_hashfn(u16 pnum)
 /**
  * sel_netport_find - Search for a port record
  * @protocol: protocol
- * @port: pnum
+ * @pnum: port
  *
  * Description:
  * Search the network port table and return the matching record.  If an entry
@@ -114,7 +113,7 @@ static void sel_netport_insert(struct sel_netport *port)
                struct sel_netport *tail;
                tail = list_entry(
                        rcu_dereference_protected(
-                               sel_netport_hash[idx].list.prev,
+                               list_tail_rcu(&sel_netport_hash[idx].list),
                                lockdep_is_held(&sel_netport_lock)),
                        struct sel_netport, list);
                list_del_rcu(&tail->list);
@@ -149,7 +148,7 @@ static int sel_netport_sid_slow(u8 protocol, u16 pnum, u32 *sid)
                return 0;
        }
 
-       ret = security_port_sid(&selinux_state, protocol, pnum, sid);
+       ret = security_port_sid(protocol, pnum, sid);
        if (ret != 0)
                goto out;
        new = kzalloc(sizeof(*new), GFP_ATOMIC);