aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
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/video.c
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/video.c')
-rw-r--r--drivers/acpi/video.c5
1 files changed, 0 insertions, 5 deletions
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) {