aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2011-03-18 00:05:57 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2011-07-20 17:10:15 -0400
commit449a68cc656fddeda448e324c57062a19cf451b9 (patch)
treed192d6582aa8a93f8e84d3b1784340c03b9d0b0e /security/selinux
parent9801c60e99ed76c5730fb290c00bfad12a419972 (diff)
security,rcu: Convert call_rcu(sel_netport_free) to kfree_rcu()
The rcu callback sel_netport_free() just calls a kfree(), so we use kfree_rcu() instead of the call_rcu(sel_netport_free). Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Stephen Smalley <sds@tycho.nsa.gov> Cc: James Morris <jmorris@namei.org> Cc: Eric Paris <eparis@parisplace.org> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/netport.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/security/selinux/netport.c b/security/selinux/netport.c
index cfe2d72d3fb7..ae76e298de7d 100644
--- a/security/selinux/netport.c
+++ b/security/selinux/netport.c
@@ -68,22 +68,6 @@ static DEFINE_SPINLOCK(sel_netport_lock);
68static struct sel_netport_bkt sel_netport_hash[SEL_NETPORT_HASH_SIZE]; 68static struct sel_netport_bkt sel_netport_hash[SEL_NETPORT_HASH_SIZE];
69 69
70/** 70/**
71 * sel_netport_free - Frees a port entry
72 * @p: the entry's RCU field
73 *
74 * Description:
75 * This function is designed to be used as a callback to the call_rcu()
76 * function so that memory allocated to a hash table port entry can be
77 * released safely.
78 *
79 */
80static void sel_netport_free(struct rcu_head *p)
81{
82 struct sel_netport *port = container_of(p, struct sel_netport, rcu);
83 kfree(port);
84}
85
86/**
87 * sel_netport_hashfn - Hashing function for the port table 71 * sel_netport_hashfn - Hashing function for the port table
88 * @pnum: port number 72 * @pnum: port number
89 * 73 *
@@ -142,7 +126,7 @@ static void sel_netport_insert(struct sel_netport *port)
142 rcu_dereference(sel_netport_hash[idx].list.prev), 126 rcu_dereference(sel_netport_hash[idx].list.prev),
143 struct sel_netport, list); 127 struct sel_netport, list);
144 list_del_rcu(&tail->list); 128 list_del_rcu(&tail->list);
145 call_rcu(&tail->rcu, sel_netport_free); 129 kfree_rcu(tail, rcu);
146 } else 130 } else
147 sel_netport_hash[idx].size++; 131 sel_netport_hash[idx].size++;
148} 132}
@@ -241,7 +225,7 @@ static void sel_netport_flush(void)
241 list_for_each_entry_safe(port, port_tmp, 225 list_for_each_entry_safe(port, port_tmp,
242 &sel_netport_hash[idx].list, list) { 226 &sel_netport_hash[idx].list, list) {
243 list_del_rcu(&port->list); 227 list_del_rcu(&port->list);
244 call_rcu(&port->rcu, sel_netport_free); 228 kfree_rcu(port, rcu);
245 } 229 }
246 sel_netport_hash[idx].size = 0; 230 sel_netport_hash[idx].size = 0;
247 } 231 }