diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2011-03-18 00:05:22 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-07-20 17:10:14 -0400 |
commit | 9801c60e99ed76c5730fb290c00bfad12a419972 (patch) | |
tree | 4c010680b33015e237f0761a3a3c79d180f13857 /security | |
parent | f218a7ee7a1c37058eef4bb5fefff9bdb0f52766 (diff) |
security,rcu: Convert call_rcu(sel_netnode_free) to kfree_rcu()
The rcu callback sel_netnode_free() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(sel_netnode_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')
-rw-r--r-- | security/selinux/netnode.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/security/selinux/netnode.c b/security/selinux/netnode.c index 3618251d0fdb..8b691a863186 100644 --- a/security/selinux/netnode.c +++ b/security/selinux/netnode.c | |||
@@ -69,22 +69,6 @@ static DEFINE_SPINLOCK(sel_netnode_lock); | |||
69 | static struct sel_netnode_bkt sel_netnode_hash[SEL_NETNODE_HASH_SIZE]; | 69 | static struct sel_netnode_bkt sel_netnode_hash[SEL_NETNODE_HASH_SIZE]; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * sel_netnode_free - Frees a node entry | ||
73 | * @p: the entry's RCU field | ||
74 | * | ||
75 | * Description: | ||
76 | * This function is designed to be used as a callback to the call_rcu() | ||
77 | * function so that memory allocated to a hash table node entry can be | ||
78 | * released safely. | ||
79 | * | ||
80 | */ | ||
81 | static void sel_netnode_free(struct rcu_head *p) | ||
82 | { | ||
83 | struct sel_netnode *node = container_of(p, struct sel_netnode, rcu); | ||
84 | kfree(node); | ||
85 | } | ||
86 | |||
87 | /** | ||
88 | * sel_netnode_hashfn_ipv4 - IPv4 hashing function for the node table | 72 | * sel_netnode_hashfn_ipv4 - IPv4 hashing function for the node table |
89 | * @addr: IPv4 address | 73 | * @addr: IPv4 address |
90 | * | 74 | * |
@@ -193,7 +177,7 @@ static void sel_netnode_insert(struct sel_netnode *node) | |||
193 | rcu_dereference(sel_netnode_hash[idx].list.prev), | 177 | rcu_dereference(sel_netnode_hash[idx].list.prev), |
194 | struct sel_netnode, list); | 178 | struct sel_netnode, list); |
195 | list_del_rcu(&tail->list); | 179 | list_del_rcu(&tail->list); |
196 | call_rcu(&tail->rcu, sel_netnode_free); | 180 | kfree_rcu(tail, rcu); |
197 | } else | 181 | } else |
198 | sel_netnode_hash[idx].size++; | 182 | sel_netnode_hash[idx].size++; |
199 | } | 183 | } |
@@ -306,7 +290,7 @@ static void sel_netnode_flush(void) | |||
306 | list_for_each_entry_safe(node, node_tmp, | 290 | list_for_each_entry_safe(node, node_tmp, |
307 | &sel_netnode_hash[idx].list, list) { | 291 | &sel_netnode_hash[idx].list, list) { |
308 | list_del_rcu(&node->list); | 292 | list_del_rcu(&node->list); |
309 | call_rcu(&node->rcu, sel_netnode_free); | 293 | kfree_rcu(node, rcu); |
310 | } | 294 | } |
311 | sel_netnode_hash[idx].size = 0; | 295 | sel_netnode_hash[idx].size = 0; |
312 | } | 296 | } |