aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
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/acpi
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/acpi')
-rw-r--r--drivers/acpi/ac.c1
-rw-r--r--drivers/acpi/battery.c1
-rw-r--r--drivers/acpi/button.c3
-rw-r--r--drivers/acpi/fan.c2
-rw-r--r--drivers/acpi/processor_core.c2
-rw-r--r--drivers/acpi/sbs.c1
-rw-r--r--drivers/acpi/thermal.c2
-rw-r--r--drivers/acpi/video.c5
8 files changed, 0 insertions, 17 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 9b917dac7732..88e42abf5d88 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -191,7 +191,6 @@ static int acpi_ac_add_fs(struct acpi_device *device)
191 acpi_ac_dir); 191 acpi_ac_dir);
192 if (!acpi_device_dir(device)) 192 if (!acpi_device_dir(device))
193 return -ENODEV; 193 return -ENODEV;
194 acpi_device_dir(device)->owner = THIS_MODULE;
195 } 194 }
196 195
197 /* 'state' [R] */ 196 /* 'state' [R] */
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 69cbc57c2d1c..3bcb5bfc45d3 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -760,7 +760,6 @@ static int acpi_battery_add_fs(struct acpi_device *device)
760 acpi_battery_dir); 760 acpi_battery_dir);
761 if (!acpi_device_dir(device)) 761 if (!acpi_device_dir(device))
762 return -ENODEV; 762 return -ENODEV;
763 acpi_device_dir(device)->owner = THIS_MODULE;
764 } 763 }
765 764
766 for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) { 765 for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) {
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 171fd914f435..c2f06069dcd4 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -200,12 +200,10 @@ static int acpi_button_add_fs(struct acpi_device *device)
200 200
201 if (!entry) 201 if (!entry)
202 return -ENODEV; 202 return -ENODEV;
203 entry->owner = THIS_MODULE;
204 203
205 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); 204 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
206 if (!acpi_device_dir(device)) 205 if (!acpi_device_dir(device))
207 return -ENODEV; 206 return -ENODEV;
208 acpi_device_dir(device)->owner = THIS_MODULE;
209 207
210 /* 'info' [R] */ 208 /* 'info' [R] */
211 entry = proc_create_data(ACPI_BUTTON_FILE_INFO, 209 entry = proc_create_data(ACPI_BUTTON_FILE_INFO,
@@ -522,7 +520,6 @@ static int __init acpi_button_init(void)
522 acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); 520 acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
523 if (!acpi_button_dir) 521 if (!acpi_button_dir)
524 return -ENODEV; 522 return -ENODEV;
525 acpi_button_dir->owner = THIS_MODULE;
526 result = acpi_bus_register_driver(&acpi_button_driver); 523 result = acpi_bus_register_driver(&acpi_button_driver);
527 if (result < 0) { 524 if (result < 0) {
528 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); 525 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index eaaee1660bdf..8a02944bf92d 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -193,7 +193,6 @@ static int acpi_fan_add_fs(struct acpi_device *device)
193 acpi_fan_dir); 193 acpi_fan_dir);
194 if (!acpi_device_dir(device)) 194 if (!acpi_device_dir(device))
195 return -ENODEV; 195 return -ENODEV;
196 acpi_device_dir(device)->owner = THIS_MODULE;
197 } 196 }
198 197
199 /* 'status' [R/W] */ 198 /* 'status' [R/W] */
@@ -347,7 +346,6 @@ static int __init acpi_fan_init(void)
347 acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); 346 acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
348 if (!acpi_fan_dir) 347 if (!acpi_fan_dir)
349 return -ENODEV; 348 return -ENODEV;
350 acpi_fan_dir->owner = THIS_MODULE;
351#endif 349#endif
352 350
353 result = acpi_bus_register_driver(&acpi_fan_driver); 351 result = acpi_bus_register_driver(&acpi_fan_driver);
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 0cc2fd31e376..fa2f7422d23d 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -359,7 +359,6 @@ static int acpi_processor_add_fs(struct acpi_device *device)
359 if (!acpi_device_dir(device)) 359 if (!acpi_device_dir(device))
360 return -ENODEV; 360 return -ENODEV;
361 } 361 }
362 acpi_device_dir(device)->owner = THIS_MODULE;
363 362
364 /* 'info' [R] */ 363 /* 'info' [R] */
365 entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO, 364 entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO,
@@ -1137,7 +1136,6 @@ static int __init acpi_processor_init(void)
1137 acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); 1136 acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
1138 if (!acpi_processor_dir) 1137 if (!acpi_processor_dir)
1139 return -ENOMEM; 1138 return -ENOMEM;
1140 acpi_processor_dir->owner = THIS_MODULE;
1141 1139
1142 /* 1140 /*
1143 * Check whether the system is DMI table. If yes, OSPM 1141 * Check whether the system is DMI table. If yes, OSPM
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 6050ce481873..59afd52ccc12 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -488,7 +488,6 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
488 if (!*dir) { 488 if (!*dir) {
489 return -ENODEV; 489 return -ENODEV;
490 } 490 }
491 (*dir)->owner = THIS_MODULE;
492 } 491 }
493 492
494 /* 'info' [R] */ 493 /* 'info' [R] */
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 99e6f1f8ea45..c11f9aeca706 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -1506,7 +1506,6 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1506 acpi_thermal_dir); 1506 acpi_thermal_dir);
1507 if (!acpi_device_dir(device)) 1507 if (!acpi_device_dir(device))
1508 return -ENODEV; 1508 return -ENODEV;
1509 acpi_device_dir(device)->owner = THIS_MODULE;
1510 } 1509 }
1511 1510
1512 /* 'state' [R] */ 1511 /* 'state' [R] */
@@ -1875,7 +1874,6 @@ static int __init acpi_thermal_init(void)
1875 acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); 1874 acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
1876 if (!acpi_thermal_dir) 1875 if (!acpi_thermal_dir)
1877 return -ENODEV; 1876 return -ENODEV;
1878 acpi_thermal_dir->owner = THIS_MODULE;
1879 1877
1880 result = acpi_bus_register_driver(&acpi_thermal_driver); 1878 result = acpi_bus_register_driver(&acpi_thermal_driver);
1881 if (result < 0) { 1879 if (result < 0) {
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index bb5ed059114a..67cc36dc9b82 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1125,8 +1125,6 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
1125 if (!device_dir) 1125 if (!device_dir)
1126 return -ENOMEM; 1126 return -ENOMEM;
1127 1127
1128 device_dir->owner = THIS_MODULE;
1129
1130 /* 'info' [R] */ 1128 /* 'info' [R] */
1131 entry = proc_create_data("info", S_IRUGO, device_dir, 1129 entry = proc_create_data("info", S_IRUGO, device_dir,
1132 &acpi_video_device_info_fops, acpi_driver_data(device)); 1130 &acpi_video_device_info_fops, acpi_driver_data(device));
@@ -1403,8 +1401,6 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1403 if (!device_dir) 1401 if (!device_dir)
1404 return -ENOMEM; 1402 return -ENOMEM;
1405 1403
1406 device_dir->owner = THIS_MODULE;
1407
1408 /* 'info' [R] */ 1404 /* 'info' [R] */
1409 entry = proc_create_data("info", S_IRUGO, device_dir, 1405 entry = proc_create_data("info", S_IRUGO, device_dir,
1410 &acpi_video_bus_info_fops, 1406 &acpi_video_bus_info_fops,
@@ -2131,7 +2127,6 @@ static int __init acpi_video_init(void)
2131 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); 2127 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
2132 if (!acpi_video_dir) 2128 if (!acpi_video_dir)
2133 return -ENODEV; 2129 return -ENODEV;
2134 acpi_video_dir->owner = THIS_MODULE;
2135 2130
2136 result = acpi_bus_register_driver(&acpi_video_bus); 2131 result = acpi_bus_register_driver(&acpi_video_bus);
2137 if (result < 0) { 2132 if (result < 0) {