aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c11
1 files changed, 3 insertions, 8 deletions
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