From 6034f7e603cd2dae8ed9a1d8d2ccfeb6b5c48d73 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Tue, 15 Mar 2011 18:07:57 +0800 Subject: security,rcu: Convert call_rcu(whitelist_item_free) to kfree_rcu() The rcu callback whitelist_item_free() just calls a kfree(), so we use kfree_rcu() instead of the call_rcu(whitelist_item_free). Signed-off-by: Lai Jiangshan Signed-off-by: Paul E. McKenney Acked-by: James Morris Reviewed-by: Josh Triplett --- security/device_cgroup.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'security') diff --git a/security/device_cgroup.c b/security/device_cgroup.c index 1be68269e1c..4450fbeec41 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c @@ -125,14 +125,6 @@ static int dev_whitelist_add(struct dev_cgroup *dev_cgroup, return 0; } -static void whitelist_item_free(struct rcu_head *rcu) -{ - struct dev_whitelist_item *item; - - item = container_of(rcu, struct dev_whitelist_item, rcu); - kfree(item); -} - /* * called under devcgroup_mutex */ @@ -155,7 +147,7 @@ remove: walk->access &= ~wh->access; if (!walk->access) { list_del_rcu(&walk->list); - call_rcu(&walk->rcu, whitelist_item_free); + kfree_rcu(walk, rcu); } } } -- cgit v1.2.3-18-g5258 From 9801c60e99ed76c5730fb290c00bfad12a419972 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Fri, 18 Mar 2011 12:05:22 +0800 Subject: 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 Signed-off-by: Paul E. McKenney Cc: Stephen Smalley Cc: James Morris Cc: Eric Paris Reviewed-by: Josh Triplett --- security/selinux/netnode.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'security') diff --git a/security/selinux/netnode.c b/security/selinux/netnode.c index 3618251d0fd..8b691a86318 100644 --- a/security/selinux/netnode.c +++ b/security/selinux/netnode.c @@ -68,22 +68,6 @@ static LIST_HEAD(sel_netnode_list); static DEFINE_SPINLOCK(sel_netnode_lock); static struct sel_netnode_bkt sel_netnode_hash[SEL_NETNODE_HASH_SIZE]; -/** - * sel_netnode_free - Frees a node entry - * @p: the entry's RCU field - * - * Description: - * This function is designed to be used as a callback to the call_rcu() - * function so that memory allocated to a hash table node entry can be - * released safely. - * - */ -static void sel_netnode_free(struct rcu_head *p) -{ - struct sel_netnode *node = container_of(p, struct sel_netnode, rcu); - kfree(node); -} - /** * sel_netnode_hashfn_ipv4 - IPv4 hashing function for the node table * @addr: IPv4 address @@ -193,7 +177,7 @@ static void sel_netnode_insert(struct sel_netnode *node) rcu_dereference(sel_netnode_hash[idx].list.prev), struct sel_netnode, list); list_del_rcu(&tail->list); - call_rcu(&tail->rcu, sel_netnode_free); + kfree_rcu(tail, rcu); } else sel_netnode_hash[idx].size++; } @@ -306,7 +290,7 @@ static void sel_netnode_flush(void) list_for_each_entry_safe(node, node_tmp, &sel_netnode_hash[idx].list, list) { list_del_rcu(&node->list); - call_rcu(&node->rcu, sel_netnode_free); + kfree_rcu(node, rcu); } sel_netnode_hash[idx].size = 0; } -- cgit v1.2.3-18-g5258 From 449a68cc656fddeda448e324c57062a19cf451b9 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Fri, 18 Mar 2011 12:05:57 +0800 Subject: 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 Signed-off-by: Paul E. McKenney Cc: Stephen Smalley Cc: James Morris Cc: Eric Paris Reviewed-by: Josh Triplett --- security/selinux/netport.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'security') diff --git a/security/selinux/netport.c b/security/selinux/netport.c index cfe2d72d3fb..ae76e298de7 100644 --- a/security/selinux/netport.c +++ b/security/selinux/netport.c @@ -67,22 +67,6 @@ static LIST_HEAD(sel_netport_list); static DEFINE_SPINLOCK(sel_netport_lock); static struct sel_netport_bkt sel_netport_hash[SEL_NETPORT_HASH_SIZE]; -/** - * sel_netport_free - Frees a port entry - * @p: the entry's RCU field - * - * Description: - * This function is designed to be used as a callback to the call_rcu() - * function so that memory allocated to a hash table port entry can be - * released safely. - * - */ -static void sel_netport_free(struct rcu_head *p) -{ - struct sel_netport *port = container_of(p, struct sel_netport, rcu); - kfree(port); -} - /** * sel_netport_hashfn - Hashing function for the port table * @pnum: port number @@ -142,7 +126,7 @@ static void sel_netport_insert(struct sel_netport *port) rcu_dereference(sel_netport_hash[idx].list.prev), struct sel_netport, list); list_del_rcu(&tail->list); - call_rcu(&tail->rcu, sel_netport_free); + kfree_rcu(tail, rcu); } else sel_netport_hash[idx].size++; } @@ -241,7 +225,7 @@ static void sel_netport_flush(void) list_for_each_entry_safe(port, port_tmp, &sel_netport_hash[idx].list, list) { list_del_rcu(&port->list); - call_rcu(&port->rcu, sel_netport_free); + kfree_rcu(port, rcu); } sel_netport_hash[idx].size = 0; } -- cgit v1.2.3-18-g5258