mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 16:11:45 +00:00
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>
This commit is contained in:
parent
667471386d
commit
cf7acfab03
17 changed files with 162 additions and 264 deletions
|
@ -102,6 +102,7 @@ static unsigned int acpi_system_poll_event(struct file *file, poll_table * wait)
|
|||
}
|
||||
|
||||
static const struct file_operations acpi_system_event_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = acpi_system_open_event,
|
||||
.read = acpi_system_read_event,
|
||||
.release = acpi_system_close_event,
|
||||
|
@ -294,10 +295,9 @@ static int __init acpi_event_init(void)
|
|||
|
||||
#ifdef CONFIG_ACPI_PROC_EVENT
|
||||
/* 'event' [R] */
|
||||
entry = create_proc_entry("event", S_IRUSR, acpi_root_dir);
|
||||
if (entry)
|
||||
entry->proc_fops = &acpi_system_event_ops;
|
||||
else
|
||||
entry = proc_create("event", S_IRUSR, acpi_root_dir,
|
||||
&acpi_system_event_ops);
|
||||
if (!entry)
|
||||
return -ENODEV;
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue