aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2009-03-25 15:48:06 -0400
committerAlexey Dobriyan <adobriyan@gmail.com>2009-03-30 17:14:44 -0400
commit99b76233803beab302123d243eea9e41149804f3 (patch)
tree398178210fe66845ccd6fa4258ba762a87e023ad /drivers/platform
parent3dec7f59c370c7b58184d63293c3dc984d475840 (diff)
proc 2/2: remove struct proc_dir_entry::owner
Setting ->owner as done currently (pde->owner = THIS_MODULE) is racy as correctly noted at bug #12454. Someone can lookup entry with NULL ->owner, thus not pinning enything, and release it later resulting in module refcount underflow. We can keep ->owner and supply it at registration time like ->proc_fops and ->data. But this leaves ->owner as easy-manipulative field (just one C assignment) and somebody will forget to unpin previous/pin current module when switching ->owner. ->proc_fops is declared as "const" which should give some thoughts. ->read_proc/->write_proc were just fixed to not require ->owner for protection. rmmod'ed directories will be empty and return "." and ".." -- no harm. And directories with tricky enough readdir and lookup shouldn't be modular. We definitely don't want such modular code. Removing ->owner will also make PDE smaller. So, let's nuke it. Kudos to Jeff Layton for reminding about this, let's say, oversight. http://bugzilla.kernel.org/show_bug.cgi?id=12454 Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/asus_acpi.c3
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c2
-rw-r--r--drivers/platform/x86/toshiba_acpi.c3
3 files changed, 0 insertions, 8 deletions
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c
index d63f26e666a4..ba1f7497e4b9 100644
--- a/drivers/platform/x86/asus_acpi.c
+++ b/drivers/platform/x86/asus_acpi.c
@@ -987,7 +987,6 @@ asus_proc_add(char *name, proc_writefunc *writefunc,
987 proc->write_proc = writefunc; 987 proc->write_proc = writefunc;
988 proc->read_proc = readfunc; 988 proc->read_proc = readfunc;
989 proc->data = acpi_driver_data(device); 989 proc->data = acpi_driver_data(device);
990 proc->owner = THIS_MODULE;
991 proc->uid = asus_uid; 990 proc->uid = asus_uid;
992 proc->gid = asus_gid; 991 proc->gid = asus_gid;
993 return 0; 992 return 0;
@@ -1020,7 +1019,6 @@ static int asus_hotk_add_fs(struct acpi_device *device)
1020 if (proc) { 1019 if (proc) {
1021 proc->read_proc = proc_read_info; 1020 proc->read_proc = proc_read_info;
1022 proc->data = acpi_driver_data(device); 1021 proc->data = acpi_driver_data(device);
1023 proc->owner = THIS_MODULE;
1024 proc->uid = asus_uid; 1022 proc->uid = asus_uid;
1025 proc->gid = asus_gid; 1023 proc->gid = asus_gid;
1026 } else { 1024 } else {
@@ -1436,7 +1434,6 @@ static int __init asus_acpi_init(void)
1436 printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n"); 1434 printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n");
1437 return -ENODEV; 1435 return -ENODEV;
1438 } 1436 }
1439 asus_proc_dir->owner = THIS_MODULE;
1440 1437
1441 result = acpi_bus_register_driver(&asus_hotk_driver); 1438 result = acpi_bus_register_driver(&asus_hotk_driver);
1442 if (result < 0) { 1439 if (result < 0) {
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index d2433204a40c..3dad27a385d3 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -6992,7 +6992,6 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
6992 ret = -ENODEV; 6992 ret = -ENODEV;
6993 goto err_out; 6993 goto err_out;
6994 } 6994 }
6995 entry->owner = THIS_MODULE;
6996 entry->data = ibm; 6995 entry->data = ibm;
6997 entry->read_proc = &dispatch_procfs_read; 6996 entry->read_proc = &dispatch_procfs_read;
6998 if (ibm->write) 6997 if (ibm->write)
@@ -7405,7 +7404,6 @@ static int __init thinkpad_acpi_module_init(void)
7405 thinkpad_acpi_module_exit(); 7404 thinkpad_acpi_module_exit();
7406 return -ENODEV; 7405 return -ENODEV;
7407 } 7406 }
7408 proc_dir->owner = THIS_MODULE;
7409 7407
7410 ret = platform_driver_register(&tpacpi_pdriver); 7408 ret = platform_driver_register(&tpacpi_pdriver);
7411 if (ret) { 7409 if (ret) {
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 40e60fc2e596..9f187265db8e 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -679,8 +679,6 @@ static acpi_status __init add_device(void)
679 toshiba_proc_dir, 679 toshiba_proc_dir,
680 (read_proc_t *) dispatch_read, 680 (read_proc_t *) dispatch_read,
681 item); 681 item);
682 if (proc)
683 proc->owner = THIS_MODULE;
684 if (proc && item->write_func) 682 if (proc && item->write_func)
685 proc->write_proc = (write_proc_t *) dispatch_write; 683 proc->write_proc = (write_proc_t *) dispatch_write;
686 } 684 }
@@ -772,7 +770,6 @@ static int __init toshiba_acpi_init(void)
772 toshiba_acpi_exit(); 770 toshiba_acpi_exit();
773 return -ENODEV; 771 return -ENODEV;
774 } else { 772 } else {
775 toshiba_proc_dir->owner = THIS_MODULE;
776 status = add_device(); 773 status = add_device();
777 if (ACPI_FAILURE(status)) { 774 if (ACPI_FAILURE(status)) {
778 toshiba_acpi_exit(); 775 toshiba_acpi_exit();