diff options
author | Denis V. Lunev <den@openvz.org> | 2008-04-29 04:02:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:06:22 -0400 |
commit | cf7acfab032ff262f42954328cdfd20a5d9aaaac (patch) | |
tree | 231698d72d4508f3b26f606f18ef844387ec43e5 /drivers/acpi/processor_perflib.c | |
parent | 667471386d4068e75a6a55b615701ced61eb6333 (diff) |
acpi: 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.
Add correct ->owner to proc_fops to fix reading/module unloading race.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Len Brown <lenb@kernel.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/acpi/processor_perflib.c')
-rw-r--r-- | drivers/acpi/processor_perflib.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index b477a4be8a69..d80b2d1441af 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -411,6 +411,7 @@ EXPORT_SYMBOL(acpi_processor_notify_smm); | |||
411 | 411 | ||
412 | static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file); | 412 | static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file); |
413 | static struct file_operations acpi_processor_perf_fops = { | 413 | static struct file_operations acpi_processor_perf_fops = { |
414 | .owner = THIS_MODULE, | ||
414 | .open = acpi_processor_perf_open_fs, | 415 | .open = acpi_processor_perf_open_fs, |
415 | .read = seq_read, | 416 | .read = seq_read, |
416 | .llseek = seq_lseek, | 417 | .llseek = seq_lseek, |
@@ -456,7 +457,6 @@ static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) | |||
456 | 457 | ||
457 | static void acpi_cpufreq_add_file(struct acpi_processor *pr) | 458 | static void acpi_cpufreq_add_file(struct acpi_processor *pr) |
458 | { | 459 | { |
459 | struct proc_dir_entry *entry = NULL; | ||
460 | struct acpi_device *device = NULL; | 460 | struct acpi_device *device = NULL; |
461 | 461 | ||
462 | 462 | ||
@@ -464,14 +464,9 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr) | |||
464 | return; | 464 | return; |
465 | 465 | ||
466 | /* add file 'performance' [R/W] */ | 466 | /* add file 'performance' [R/W] */ |
467 | entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, | 467 | proc_create_data(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO, |
468 | S_IFREG | S_IRUGO, | 468 | acpi_device_dir(device), |
469 | acpi_device_dir(device)); | 469 | &acpi_processor_perf_fops, acpi_driver_data(device)); |
470 | if (entry){ | ||
471 | entry->proc_fops = &acpi_processor_perf_fops; | ||
472 | entry->data = acpi_driver_data(device); | ||
473 | entry->owner = THIS_MODULE; | ||
474 | } | ||
475 | return; | 470 | return; |
476 | } | 471 | } |
477 | 472 | ||