aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-22 19:44:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-22 19:44:08 -0400
commit0342cbcfced2ee937d7c8e1c63f3d3082da7c7dc (patch)
treefb98291d321a50de2dfd99f9bcaa33274f0c3952
parent391d6276db9fbdedfbc30e1b56390414f0e55988 (diff)
parent7f70893173b056df691b2ee7546bb44fd9abae6a (diff)
Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: rcu: Fix wrong check in list_splice_init_rcu() net,rcu: Convert call_rcu(xt_rateest_free_rcu) to kfree_rcu() sysctl,rcu: Convert call_rcu(free_head) to kfree vmalloc,rcu: Convert call_rcu(rcu_free_vb) to kfree_rcu() vmalloc,rcu: Convert call_rcu(rcu_free_va) to kfree_rcu() ipc,rcu: Convert call_rcu(ipc_immediate_free) to kfree_rcu() ipc,rcu: Convert call_rcu(free_un) to kfree_rcu() security,rcu: Convert call_rcu(sel_netport_free) to kfree_rcu() security,rcu: Convert call_rcu(sel_netnode_free) to kfree_rcu() ia64,rcu: Convert call_rcu(sn_irq_info_free) to kfree_rcu() block,rcu: Convert call_rcu(disk_free_ptbl_rcu_cb) to kfree_rcu() scsi,rcu: Convert call_rcu(fc_rport_free_rcu) to kfree_rcu() audit_tree,rcu: Convert call_rcu(__put_tree) to kfree_rcu() security,rcu: Convert call_rcu(whitelist_item_free) to kfree_rcu() md,rcu: Convert call_rcu(free_conf) to kfree_rcu()
-rw-r--r--arch/ia64/sn/kernel/irq.c14
-rw-r--r--block/genhd.c10
-rw-r--r--drivers/md/linear.c8
-rw-r--r--drivers/scsi/libfc/fc_rport.c14
-rw-r--r--include/linux/rculist.h2
-rw-r--r--ipc/sem.c10
-rw-r--r--ipc/util.c16
-rw-r--r--kernel/audit_tree.c8
-rw-r--r--kernel/sysctl.c11
-rw-r--r--mm/vmalloc.c18
-rw-r--r--net/netfilter/xt_RATEEST.c8
-rw-r--r--security/device_cgroup.c10
-rw-r--r--security/selinux/netnode.c20
-rw-r--r--security/selinux/netport.c20
14 files changed, 21 insertions, 148 deletions
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 81a1f4e6bcd8..485c42d97e83 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -112,8 +112,6 @@ static void sn_ack_irq(struct irq_data *data)
112 irq_move_irq(data); 112 irq_move_irq(data);
113} 113}
114 114
115static void sn_irq_info_free(struct rcu_head *head);
116
117struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info, 115struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
118 nasid_t nasid, int slice) 116 nasid_t nasid, int slice)
119{ 117{
@@ -177,7 +175,7 @@ struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
177 spin_lock(&sn_irq_info_lock); 175 spin_lock(&sn_irq_info_lock);
178 list_replace_rcu(&sn_irq_info->list, &new_irq_info->list); 176 list_replace_rcu(&sn_irq_info->list, &new_irq_info->list);
179 spin_unlock(&sn_irq_info_lock); 177 spin_unlock(&sn_irq_info_lock);
180 call_rcu(&sn_irq_info->rcu, sn_irq_info_free); 178 kfree_rcu(sn_irq_info, rcu);
181 179
182 180
183finish_up: 181finish_up:
@@ -338,14 +336,6 @@ static void unregister_intr_pda(struct sn_irq_info *sn_irq_info)
338 rcu_read_unlock(); 336 rcu_read_unlock();
339} 337}
340 338
341static void sn_irq_info_free(struct rcu_head *head)
342{
343 struct sn_irq_info *sn_irq_info;
344
345 sn_irq_info = container_of(head, struct sn_irq_info, rcu);
346 kfree(sn_irq_info);
347}
348
349void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info) 339void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
350{ 340{
351 nasid_t nasid = sn_irq_info->irq_nasid; 341 nasid_t nasid = sn_irq_info->irq_nasid;
@@ -399,7 +389,7 @@ void sn_irq_unfixup(struct pci_dev *pci_dev)
399 spin_unlock(&sn_irq_info_lock); 389 spin_unlock(&sn_irq_info_lock);
400 if (list_empty(sn_irq_lh[sn_irq_info->irq_irq])) 390 if (list_empty(sn_irq_lh[sn_irq_info->irq_irq]))
401 free_irq_vector(sn_irq_info->irq_irq); 391 free_irq_vector(sn_irq_info->irq_irq);
402 call_rcu(&sn_irq_info->rcu, sn_irq_info_free); 392 kfree_rcu(sn_irq_info, rcu);
403 pci_dev_put(pci_dev); 393 pci_dev_put(pci_dev);
404 394
405} 395}
diff --git a/block/genhd.c b/block/genhd.c
index 3608289c8ecd..6024b82e3209 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1018,14 +1018,6 @@ static const struct attribute_group *disk_attr_groups[] = {
1018 NULL 1018 NULL
1019}; 1019};
1020 1020
1021static void disk_free_ptbl_rcu_cb(struct rcu_head *head)
1022{
1023 struct disk_part_tbl *ptbl =
1024 container_of(head, struct disk_part_tbl, rcu_head);
1025
1026 kfree(ptbl);
1027}
1028
1029/** 1021/**
1030 * disk_replace_part_tbl - replace disk->part_tbl in RCU-safe way 1022 * disk_replace_part_tbl - replace disk->part_tbl in RCU-safe way
1031 * @disk: disk to replace part_tbl for 1023 * @disk: disk to replace part_tbl for
@@ -1046,7 +1038,7 @@ static void disk_replace_part_tbl(struct gendisk *disk,
1046 1038
1047 if (old_ptbl) { 1039 if (old_ptbl) {
1048 rcu_assign_pointer(old_ptbl->last_lookup, NULL); 1040 rcu_assign_pointer(old_ptbl->last_lookup, NULL);
1049 call_rcu(&old_ptbl->rcu_head, disk_free_ptbl_rcu_cb); 1041 kfree_rcu(old_ptbl, rcu_head);
1050 } 1042 }
1051} 1043}
1052 1044
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index abfb59a61ede..6cd2c313e800 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -213,12 +213,6 @@ static int linear_run (mddev_t *mddev)
213 return md_integrity_register(mddev); 213 return md_integrity_register(mddev);
214} 214}
215 215
216static void free_conf(struct rcu_head *head)
217{
218 linear_conf_t *conf = container_of(head, linear_conf_t, rcu);
219 kfree(conf);
220}
221
222static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev) 216static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
223{ 217{
224 /* Adding a drive to a linear array allows the array to grow. 218 /* Adding a drive to a linear array allows the array to grow.
@@ -247,7 +241,7 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
247 md_set_array_sectors(mddev, linear_size(mddev, 0, 0)); 241 md_set_array_sectors(mddev, linear_size(mddev, 0, 0));
248 set_capacity(mddev->gendisk, mddev->array_sectors); 242 set_capacity(mddev->gendisk, mddev->array_sectors);
249 revalidate_disk(mddev->gendisk); 243 revalidate_disk(mddev->gendisk);
250 call_rcu(&oldconf->rcu, free_conf); 244 kfree_rcu(oldconf, rcu);
251 return 0; 245 return 0;
252} 246}
253 247
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 49e1ccca09d5..01e13a2eb93a 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -153,18 +153,6 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
153} 153}
154 154
155/** 155/**
156 * fc_rport_free_rcu() - Free a remote port
157 * @rcu: The rcu_head structure inside the remote port
158 */
159static void fc_rport_free_rcu(struct rcu_head *rcu)
160{
161 struct fc_rport_priv *rdata;
162
163 rdata = container_of(rcu, struct fc_rport_priv, rcu);
164 kfree(rdata);
165}
166
167/**
168 * fc_rport_destroy() - Free a remote port after last reference is released 156 * fc_rport_destroy() - Free a remote port after last reference is released
169 * @kref: The remote port's kref 157 * @kref: The remote port's kref
170 */ 158 */
@@ -173,7 +161,7 @@ static void fc_rport_destroy(struct kref *kref)
173 struct fc_rport_priv *rdata; 161 struct fc_rport_priv *rdata;
174 162
175 rdata = container_of(kref, struct fc_rport_priv, kref); 163 rdata = container_of(kref, struct fc_rport_priv, kref);
176 call_rcu(&rdata->rcu, fc_rport_free_rcu); 164 kfree_rcu(rdata, rcu);
177} 165}
178 166
179/** 167/**
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index e3beb315517a..d079290843a9 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -183,7 +183,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
183 struct list_head *last = list->prev; 183 struct list_head *last = list->prev;
184 struct list_head *at = head->next; 184 struct list_head *at = head->next;
185 185
186 if (list_empty(head)) 186 if (list_empty(list))
187 return; 187 return;
188 188
189 /* "first" and "last" tracking list, so initialize it. */ 189 /* "first" and "last" tracking list, so initialize it. */
diff --git a/ipc/sem.c b/ipc/sem.c
index 34193ed69fbe..8b929e6a6eda 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -689,12 +689,6 @@ static int count_semzcnt (struct sem_array * sma, ushort semnum)
689 return semzcnt; 689 return semzcnt;
690} 690}
691 691
692static void free_un(struct rcu_head *head)
693{
694 struct sem_undo *un = container_of(head, struct sem_undo, rcu);
695 kfree(un);
696}
697
698/* Free a semaphore set. freeary() is called with sem_ids.rw_mutex locked 692/* Free a semaphore set. freeary() is called with sem_ids.rw_mutex locked
699 * as a writer and the spinlock for this semaphore set hold. sem_ids.rw_mutex 693 * as a writer and the spinlock for this semaphore set hold. sem_ids.rw_mutex
700 * remains locked on exit. 694 * remains locked on exit.
@@ -714,7 +708,7 @@ static void freeary(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)
714 un->semid = -1; 708 un->semid = -1;
715 list_del_rcu(&un->list_proc); 709 list_del_rcu(&un->list_proc);
716 spin_unlock(&un->ulp->lock); 710 spin_unlock(&un->ulp->lock);
717 call_rcu(&un->rcu, free_un); 711 kfree_rcu(un, rcu);
718 } 712 }
719 713
720 /* Wake up all pending processes and let them fail with EIDRM. */ 714 /* Wake up all pending processes and let them fail with EIDRM. */
@@ -1612,7 +1606,7 @@ void exit_sem(struct task_struct *tsk)
1612 sem_unlock(sma); 1606 sem_unlock(sma);
1613 wake_up_sem_queue_do(&tasks); 1607 wake_up_sem_queue_do(&tasks);
1614 1608
1615 call_rcu(&un->rcu, free_un); 1609 kfree_rcu(un, rcu);
1616 } 1610 }
1617 kfree(ulp); 1611 kfree(ulp);
1618} 1612}
diff --git a/ipc/util.c b/ipc/util.c
index 5c0d28921ba8..75261a31d48d 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -579,19 +579,6 @@ static void ipc_schedule_free(struct rcu_head *head)
579 schedule_work(&sched->work); 579 schedule_work(&sched->work);
580} 580}
581 581
582/**
583 * ipc_immediate_free - free ipc + rcu space
584 * @head: RCU callback structure that contains pointer to be freed
585 *
586 * Free from the RCU callback context.
587 */
588static void ipc_immediate_free(struct rcu_head *head)
589{
590 struct ipc_rcu_grace *free =
591 container_of(head, struct ipc_rcu_grace, rcu);
592 kfree(free);
593}
594
595void ipc_rcu_putref(void *ptr) 582void ipc_rcu_putref(void *ptr)
596{ 583{
597 if (--container_of(ptr, struct ipc_rcu_hdr, data)->refcount > 0) 584 if (--container_of(ptr, struct ipc_rcu_hdr, data)->refcount > 0)
@@ -601,8 +588,7 @@ void ipc_rcu_putref(void *ptr)
601 call_rcu(&container_of(ptr, struct ipc_rcu_grace, data)->rcu, 588 call_rcu(&container_of(ptr, struct ipc_rcu_grace, data)->rcu,
602 ipc_schedule_free); 589 ipc_schedule_free);
603 } else { 590 } else {
604 call_rcu(&container_of(ptr, struct ipc_rcu_grace, data)->rcu, 591 kfree_rcu(container_of(ptr, struct ipc_rcu_grace, data), rcu);
605 ipc_immediate_free);
606 } 592 }
607} 593}
608 594
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index e99dda04b126..5bf0790497e7 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -93,16 +93,10 @@ static inline void get_tree(struct audit_tree *tree)
93 atomic_inc(&tree->count); 93 atomic_inc(&tree->count);
94} 94}
95 95
96static void __put_tree(struct rcu_head *rcu)
97{
98 struct audit_tree *tree = container_of(rcu, struct audit_tree, head);
99 kfree(tree);
100}
101
102static inline void put_tree(struct audit_tree *tree) 96static inline void put_tree(struct audit_tree *tree)
103{ 97{
104 if (atomic_dec_and_test(&tree->count)) 98 if (atomic_dec_and_test(&tree->count))
105 call_rcu(&tree->head, __put_tree); 99 kfree_rcu(tree, head);
106} 100}
107 101
108/* to avoid bringing the entire thing in audit.h */ 102/* to avoid bringing the entire thing in audit.h */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f175d98bd355..11d65b531e50 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1590,16 +1590,11 @@ void sysctl_head_get(struct ctl_table_header *head)
1590 spin_unlock(&sysctl_lock); 1590 spin_unlock(&sysctl_lock);
1591} 1591}
1592 1592
1593static void free_head(struct rcu_head *rcu)
1594{
1595 kfree(container_of(rcu, struct ctl_table_header, rcu));
1596}
1597
1598void sysctl_head_put(struct ctl_table_header *head) 1593void sysctl_head_put(struct ctl_table_header *head)
1599{ 1594{
1600 spin_lock(&sysctl_lock); 1595 spin_lock(&sysctl_lock);
1601 if (!--head->count) 1596 if (!--head->count)
1602 call_rcu(&head->rcu, free_head); 1597 kfree_rcu(head, rcu);
1603 spin_unlock(&sysctl_lock); 1598 spin_unlock(&sysctl_lock);
1604} 1599}
1605 1600
@@ -1971,10 +1966,10 @@ void unregister_sysctl_table(struct ctl_table_header * header)
1971 start_unregistering(header); 1966 start_unregistering(header);
1972 if (!--header->parent->count) { 1967 if (!--header->parent->count) {
1973 WARN_ON(1); 1968 WARN_ON(1);
1974 call_rcu(&header->parent->rcu, free_head); 1969 kfree_rcu(header->parent, rcu);
1975 } 1970 }
1976 if (!--header->count) 1971 if (!--header->count)
1977 call_rcu(&header->rcu, free_head); 1972 kfree_rcu(header, rcu);
1978 spin_unlock(&sysctl_lock); 1973 spin_unlock(&sysctl_lock);
1979} 1974}
1980 1975
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 1d34d75366a7..ab8494cde007 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -452,13 +452,6 @@ overflow:
452 return ERR_PTR(-EBUSY); 452 return ERR_PTR(-EBUSY);
453} 453}
454 454
455static void rcu_free_va(struct rcu_head *head)
456{
457 struct vmap_area *va = container_of(head, struct vmap_area, rcu_head);
458
459 kfree(va);
460}
461
462static void __free_vmap_area(struct vmap_area *va) 455static void __free_vmap_area(struct vmap_area *va)
463{ 456{
464 BUG_ON(RB_EMPTY_NODE(&va->rb_node)); 457 BUG_ON(RB_EMPTY_NODE(&va->rb_node));
@@ -491,7 +484,7 @@ static void __free_vmap_area(struct vmap_area *va)
491 if (va->va_end > VMALLOC_START && va->va_end <= VMALLOC_END) 484 if (va->va_end > VMALLOC_START && va->va_end <= VMALLOC_END)
492 vmap_area_pcpu_hole = max(vmap_area_pcpu_hole, va->va_end); 485 vmap_area_pcpu_hole = max(vmap_area_pcpu_hole, va->va_end);
493 486
494 call_rcu(&va->rcu_head, rcu_free_va); 487 kfree_rcu(va, rcu_head);
495} 488}
496 489
497/* 490/*
@@ -837,13 +830,6 @@ static struct vmap_block *new_vmap_block(gfp_t gfp_mask)
837 return vb; 830 return vb;
838} 831}
839 832
840static void rcu_free_vb(struct rcu_head *head)
841{
842 struct vmap_block *vb = container_of(head, struct vmap_block, rcu_head);
843
844 kfree(vb);
845}
846
847static void free_vmap_block(struct vmap_block *vb) 833static void free_vmap_block(struct vmap_block *vb)
848{ 834{
849 struct vmap_block *tmp; 835 struct vmap_block *tmp;
@@ -856,7 +842,7 @@ static void free_vmap_block(struct vmap_block *vb)
856 BUG_ON(tmp != vb); 842 BUG_ON(tmp != vb);
857 843
858 free_vmap_area_noflush(vb->va); 844 free_vmap_area_noflush(vb->va);
859 call_rcu(&vb->rcu_head, rcu_free_vb); 845 kfree_rcu(vb, rcu_head);
860} 846}
861 847
862static void purge_fragmented_blocks(int cpu) 848static void purge_fragmented_blocks(int cpu)
diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c
index de079abd5bc8..f264032b8c56 100644
--- a/net/netfilter/xt_RATEEST.c
+++ b/net/netfilter/xt_RATEEST.c
@@ -60,11 +60,6 @@ struct xt_rateest *xt_rateest_lookup(const char *name)
60} 60}
61EXPORT_SYMBOL_GPL(xt_rateest_lookup); 61EXPORT_SYMBOL_GPL(xt_rateest_lookup);
62 62
63static void xt_rateest_free_rcu(struct rcu_head *head)
64{
65 kfree(container_of(head, struct xt_rateest, rcu));
66}
67
68void xt_rateest_put(struct xt_rateest *est) 63void xt_rateest_put(struct xt_rateest *est)
69{ 64{
70 mutex_lock(&xt_rateest_mutex); 65 mutex_lock(&xt_rateest_mutex);
@@ -75,7 +70,7 @@ void xt_rateest_put(struct xt_rateest *est)
75 * gen_estimator est_timer() might access est->lock or bstats, 70 * gen_estimator est_timer() might access est->lock or bstats,
76 * wait a RCU grace period before freeing 'est' 71 * wait a RCU grace period before freeing 'est'
77 */ 72 */
78 call_rcu(&est->rcu, xt_rateest_free_rcu); 73 kfree_rcu(est, rcu);
79 } 74 }
80 mutex_unlock(&xt_rateest_mutex); 75 mutex_unlock(&xt_rateest_mutex);
81} 76}
@@ -188,7 +183,6 @@ static int __init xt_rateest_tg_init(void)
188static void __exit xt_rateest_tg_fini(void) 183static void __exit xt_rateest_tg_fini(void)
189{ 184{
190 xt_unregister_target(&xt_rateest_tg_reg); 185 xt_unregister_target(&xt_rateest_tg_reg);
191 rcu_barrier(); /* Wait for completion of call_rcu()'s (xt_rateest_free_rcu) */
192} 186}
193 187
194 188
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 1be68269e1c2..4450fbeec411 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,
125 return 0; 125 return 0;
126} 126}
127 127
128static void whitelist_item_free(struct rcu_head *rcu)
129{
130 struct dev_whitelist_item *item;
131
132 item = container_of(rcu, struct dev_whitelist_item, rcu);
133 kfree(item);
134}
135
136/* 128/*
137 * called under devcgroup_mutex 129 * called under devcgroup_mutex
138 */ 130 */
@@ -155,7 +147,7 @@ remove:
155 walk->access &= ~wh->access; 147 walk->access &= ~wh->access;
156 if (!walk->access) { 148 if (!walk->access) {
157 list_del_rcu(&walk->list); 149 list_del_rcu(&walk->list);
158 call_rcu(&walk->rcu, whitelist_item_free); 150 kfree_rcu(walk, rcu);
159 } 151 }
160 } 152 }
161} 153}
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);
69static struct sel_netnode_bkt sel_netnode_hash[SEL_NETNODE_HASH_SIZE]; 69static 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 */
81static 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 }
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 }