Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c33fff0a authored by Denis V. Lunev's avatar Denis V. Lunev Committed by Linus Torvalds
Browse files

kernel: use non-racy method for proc entries creation



Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data
be setup before gluing PDE to main tree.

Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ac41cfd1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -79,11 +79,11 @@ static int __init ikconfig_init(void)
	struct proc_dir_entry *entry;

	/* create the current config file */
	entry = create_proc_entry("config.gz", S_IFREG | S_IRUGO, NULL);
	entry = proc_create("config.gz", S_IFREG | S_IRUGO, NULL,
			    &ikconfig_file_ops);
	if (!entry)
		return -ENOMEM;

	entry->proc_fops = &ikconfig_file_ops;
	entry->size = kernel_config_data_size;

	return 0;
+1 −6
Original line number Diff line number Diff line
@@ -149,12 +149,7 @@ static const struct file_operations proc_dma_operations = {

static int __init proc_dma_init(void)
{
	struct proc_dir_entry *e;

	e = create_proc_entry("dma", 0, NULL);
	if (e)
		e->proc_fops = &proc_dma_operations;

	proc_create("dma", 0, NULL, &proc_dma_operations);
	return 0;
}

+1 −5
Original line number Diff line number Diff line
@@ -472,11 +472,7 @@ static const struct file_operations kallsyms_operations = {

static int __init kallsyms_init(void)
{
	struct proc_dir_entry *entry;

	entry = create_proc_entry("kallsyms", 0444, NULL);
	if (entry)
		entry->proc_fops = &kallsyms_operations;
	proc_create("kallsyms", 0444, NULL, &kallsyms_operations);
	return 0;
}
__initcall(kallsyms_init);
+1 −8
Original line number Diff line number Diff line
@@ -233,14 +233,7 @@ static struct file_operations lstats_fops = {

static int __init init_lstats_procfs(void)
{
	struct proc_dir_entry *pe;

	pe = create_proc_entry("latency_stats", 0644, NULL);
	if (!pe)
		return -ENOMEM;

	pe->proc_fops = &lstats_fops;

	proc_create("latency_stats", 0644, NULL, &lstats_fops);
	return 0;
}
__initcall(init_lstats_procfs);
+4 −12
Original line number Diff line number Diff line
@@ -660,20 +660,12 @@ static const struct file_operations proc_lock_stat_operations = {

static int __init lockdep_proc_init(void)
{
	struct proc_dir_entry *entry;

	entry = create_proc_entry("lockdep", S_IRUSR, NULL);
	if (entry)
		entry->proc_fops = &proc_lockdep_operations;

	entry = create_proc_entry("lockdep_stats", S_IRUSR, NULL);
	if (entry)
		entry->proc_fops = &proc_lockdep_stats_operations;
	proc_create("lockdep", S_IRUSR, NULL, &proc_lockdep_operations);
	proc_create("lockdep_stats", S_IRUSR, NULL,
		    &proc_lockdep_stats_operations);

#ifdef CONFIG_LOCK_STAT
	entry = create_proc_entry("lock_stat", S_IRUSR, NULL);
	if (entry)
		entry->proc_fops = &proc_lock_stat_operations;
	proc_create("lock_stat", S_IRUSR, NULL, &proc_lock_stat_operations);
#endif

	return 0;
Loading