|
@@ -194,9 +194,9 @@ static int sysrq_sysctl_handler(ctl_table *table, int write,
|
|
|
static struct ctl_table root_table[];
|
|
|
static struct ctl_table_root sysctl_table_root;
|
|
|
static struct ctl_table_header root_table_header = {
|
|
|
- .count = 1,
|
|
|
+ {{.count = 1,
|
|
|
.ctl_table = root_table,
|
|
|
- .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),
|
|
|
+ .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),}},
|
|
|
.root = &sysctl_table_root,
|
|
|
.set = &sysctl_table_root.default_set,
|
|
|
};
|
|
@@ -1567,11 +1567,16 @@ void sysctl_head_get(struct ctl_table_header *head)
|
|
|
spin_unlock(&sysctl_lock);
|
|
|
}
|
|
|
|
|
|
+static void free_head(struct rcu_head *rcu)
|
|
|
+{
|
|
|
+ kfree(container_of(rcu, struct ctl_table_header, rcu));
|
|
|
+}
|
|
|
+
|
|
|
void sysctl_head_put(struct ctl_table_header *head)
|
|
|
{
|
|
|
spin_lock(&sysctl_lock);
|
|
|
if (!--head->count)
|
|
|
- kfree(head);
|
|
|
+ call_rcu(&head->rcu, free_head);
|
|
|
spin_unlock(&sysctl_lock);
|
|
|
}
|
|
|
|
|
@@ -1948,10 +1953,10 @@ void unregister_sysctl_table(struct ctl_table_header * header)
|
|
|
start_unregistering(header);
|
|
|
if (!--header->parent->count) {
|
|
|
WARN_ON(1);
|
|
|
- kfree(header->parent);
|
|
|
+ call_rcu(&header->parent->rcu, free_head);
|
|
|
}
|
|
|
if (!--header->count)
|
|
|
- kfree(header);
|
|
|
+ call_rcu(&header->rcu, free_head);
|
|
|
spin_unlock(&sysctl_lock);
|
|
|
}
|
|
|
|