aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-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
-rw-r--r--drivers/block/ps3vram.c2
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c12
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c6
-rw-r--r--drivers/input/input.c2
-rw-r--r--drivers/isdn/hardware/eicon/divasi.c1
-rw-r--r--drivers/media/video/cpia.c4
-rw-r--r--drivers/message/i2o/i2o_proc.c2
-rw-r--r--drivers/net/bonding/bond_main.c35
-rw-r--r--drivers/net/irda/vlsi_ir.c7
-rw-r--r--drivers/net/wireless/airo.c1
-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
-rw-r--r--drivers/rtc/rtc-proc.c10
-rw-r--r--drivers/s390/block/dasd_proc.c2
-rw-r--r--drivers/scsi/scsi_devinfo.c2
-rw-r--r--drivers/scsi/scsi_proc.c3
-rw-r--r--drivers/video/via/viafbdev.c5
26 files changed, 12 insertions, 107 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) {
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index 393ed6760d78..8eddef373a91 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -551,8 +551,6 @@ static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev)
551 dev_warn(&dev->core, "failed to create /proc entry\n"); 551 dev_warn(&dev->core, "failed to create /proc entry\n");
552 return; 552 return;
553 } 553 }
554
555 pde->owner = THIS_MODULE;
556 pde->data = priv; 554 pde->data = priv;
557} 555}
558 556
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 7a88dfd4427b..e93fc8d22fb2 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -1944,7 +1944,7 @@ static int stat_file_read_proc(char *page, char **start, off_t off,
1944 1944
1945int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, 1945int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
1946 read_proc_t *read_proc, 1946 read_proc_t *read_proc,
1947 void *data, struct module *owner) 1947 void *data)
1948{ 1948{
1949 int rv = 0; 1949 int rv = 0;
1950#ifdef CONFIG_PROC_FS 1950#ifdef CONFIG_PROC_FS
@@ -1970,7 +1970,6 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
1970 } else { 1970 } else {
1971 file->data = data; 1971 file->data = data;
1972 file->read_proc = read_proc; 1972 file->read_proc = read_proc;
1973 file->owner = owner;
1974 1973
1975 mutex_lock(&smi->proc_entry_lock); 1974 mutex_lock(&smi->proc_entry_lock);
1976 /* Stick it on the list. */ 1975 /* Stick it on the list. */
@@ -1993,23 +1992,21 @@ static int add_proc_entries(ipmi_smi_t smi, int num)
1993 smi->proc_dir = proc_mkdir(smi->proc_dir_name, proc_ipmi_root); 1992 smi->proc_dir = proc_mkdir(smi->proc_dir_name, proc_ipmi_root);
1994 if (!smi->proc_dir) 1993 if (!smi->proc_dir)
1995 rv = -ENOMEM; 1994 rv = -ENOMEM;
1996 else
1997 smi->proc_dir->owner = THIS_MODULE;
1998 1995
1999 if (rv == 0) 1996 if (rv == 0)
2000 rv = ipmi_smi_add_proc_entry(smi, "stats", 1997 rv = ipmi_smi_add_proc_entry(smi, "stats",
2001 stat_file_read_proc, 1998 stat_file_read_proc,
2002 smi, THIS_MODULE); 1999 smi);
2003 2000
2004 if (rv == 0) 2001 if (rv == 0)
2005 rv = ipmi_smi_add_proc_entry(smi, "ipmb", 2002 rv = ipmi_smi_add_proc_entry(smi, "ipmb",
2006 ipmb_file_read_proc, 2003 ipmb_file_read_proc,
2007 smi, THIS_MODULE); 2004 smi);
2008 2005
2009 if (rv == 0) 2006 if (rv == 0)
2010 rv = ipmi_smi_add_proc_entry(smi, "version", 2007 rv = ipmi_smi_add_proc_entry(smi, "version",
2011 version_file_read_proc, 2008 version_file_read_proc,
2012 smi, THIS_MODULE); 2009 smi);
2013#endif /* CONFIG_PROC_FS */ 2010#endif /* CONFIG_PROC_FS */
2014 2011
2015 return rv; 2012 return rv;
@@ -4265,7 +4262,6 @@ static int ipmi_init_msghandler(void)
4265 return -ENOMEM; 4262 return -ENOMEM;
4266 } 4263 }
4267 4264
4268 proc_ipmi_root->owner = THIS_MODULE;
4269#endif /* CONFIG_PROC_FS */ 4265#endif /* CONFIG_PROC_FS */
4270 4266
4271 setup_timer(&ipmi_timer, ipmi_timeout, 0); 4267 setup_timer(&ipmi_timer, ipmi_timeout, 0);
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 3000135f2ead..e58ea4cd55ce 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2899,7 +2899,7 @@ static int try_smi_init(struct smi_info *new_smi)
2899 2899
2900 rv = ipmi_smi_add_proc_entry(new_smi->intf, "type", 2900 rv = ipmi_smi_add_proc_entry(new_smi->intf, "type",
2901 type_file_read_proc, 2901 type_file_read_proc,
2902 new_smi, THIS_MODULE); 2902 new_smi);
2903 if (rv) { 2903 if (rv) {
2904 printk(KERN_ERR 2904 printk(KERN_ERR
2905 "ipmi_si: Unable to create proc entry: %d\n", 2905 "ipmi_si: Unable to create proc entry: %d\n",
@@ -2909,7 +2909,7 @@ static int try_smi_init(struct smi_info *new_smi)
2909 2909
2910 rv = ipmi_smi_add_proc_entry(new_smi->intf, "si_stats", 2910 rv = ipmi_smi_add_proc_entry(new_smi->intf, "si_stats",
2911 stat_file_read_proc, 2911 stat_file_read_proc,
2912 new_smi, THIS_MODULE); 2912 new_smi);
2913 if (rv) { 2913 if (rv) {
2914 printk(KERN_ERR 2914 printk(KERN_ERR
2915 "ipmi_si: Unable to create proc entry: %d\n", 2915 "ipmi_si: Unable to create proc entry: %d\n",
@@ -2919,7 +2919,7 @@ static int try_smi_init(struct smi_info *new_smi)
2919 2919
2920 rv = ipmi_smi_add_proc_entry(new_smi->intf, "params", 2920 rv = ipmi_smi_add_proc_entry(new_smi->intf, "params",
2921 param_read_proc, 2921 param_read_proc,
2922 new_smi, THIS_MODULE); 2922 new_smi);
2923 if (rv) { 2923 if (rv) {
2924 printk(KERN_ERR 2924 printk(KERN_ERR
2925 "ipmi_si: Unable to create proc entry: %d\n", 2925 "ipmi_si: Unable to create proc entry: %d\n",
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 1730d7331a5d..ec3db3ade118 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -903,8 +903,6 @@ static int __init input_proc_init(void)
903 if (!proc_bus_input_dir) 903 if (!proc_bus_input_dir)
904 return -ENOMEM; 904 return -ENOMEM;
905 905
906 proc_bus_input_dir->owner = THIS_MODULE;
907
908 entry = proc_create("devices", 0, proc_bus_input_dir, 906 entry = proc_create("devices", 0, proc_bus_input_dir,
909 &input_devices_fileops); 907 &input_devices_fileops);
910 if (!entry) 908 if (!entry)
diff --git a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c
index f4969fe0a055..69e71ebe7841 100644
--- a/drivers/isdn/hardware/eicon/divasi.c
+++ b/drivers/isdn/hardware/eicon/divasi.c
@@ -118,7 +118,6 @@ static int DIVA_INIT_FUNCTION create_um_idi_proc(void)
118 return (0); 118 return (0);
119 119
120 um_idi_proc_entry->read_proc = um_idi_proc_read; 120 um_idi_proc_entry->read_proc = um_idi_proc_read;
121 um_idi_proc_entry->owner = THIS_MODULE;
122 121
123 return (1); 122 return (1);
124} 123}
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index c3b0c8c63c76..43ab0adf3b61 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -1381,9 +1381,7 @@ static void proc_cpia_create(void)
1381{ 1381{
1382 cpia_proc_root = proc_mkdir("cpia", NULL); 1382 cpia_proc_root = proc_mkdir("cpia", NULL);
1383 1383
1384 if (cpia_proc_root) 1384 if (!cpia_proc_root)
1385 cpia_proc_root->owner = THIS_MODULE;
1386 else
1387 LOG("Unable to initialise /proc/cpia\n"); 1385 LOG("Unable to initialise /proc/cpia\n");
1388} 1386}
1389 1387
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 9a36b5a7de57..7045c45da9b1 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -2037,8 +2037,6 @@ static int __init i2o_proc_fs_create(void)
2037 if (!i2o_proc_dir_root) 2037 if (!i2o_proc_dir_root)
2038 return -1; 2038 return -1;
2039 2039
2040 i2o_proc_dir_root->owner = THIS_MODULE;
2041
2042 list_for_each_entry(c, &i2o_controllers, list) 2040 list_for_each_entry(c, &i2o_controllers, list)
2043 i2o_proc_iop_add(i2o_proc_dir_root, c); 2041 i2o_proc_iop_add(i2o_proc_dir_root, c);
2044 2042
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 9c326a50a3ee..99610f358c40 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3444,25 +3444,12 @@ static void bond_remove_proc_entry(struct bonding *bond)
3444 */ 3444 */
3445static void bond_create_proc_dir(void) 3445static void bond_create_proc_dir(void)
3446{ 3446{
3447 int len = strlen(DRV_NAME);
3448
3449 for (bond_proc_dir = init_net.proc_net->subdir; bond_proc_dir;
3450 bond_proc_dir = bond_proc_dir->next) {
3451 if ((bond_proc_dir->namelen == len) &&
3452 !memcmp(bond_proc_dir->name, DRV_NAME, len)) {
3453 break;
3454 }
3455 }
3456
3457 if (!bond_proc_dir) { 3447 if (!bond_proc_dir) {
3458 bond_proc_dir = proc_mkdir(DRV_NAME, init_net.proc_net); 3448 bond_proc_dir = proc_mkdir(DRV_NAME, init_net.proc_net);
3459 if (bond_proc_dir) { 3449 if (!bond_proc_dir)
3460 bond_proc_dir->owner = THIS_MODULE;
3461 } else {
3462 printk(KERN_WARNING DRV_NAME 3450 printk(KERN_WARNING DRV_NAME
3463 ": Warning: cannot create /proc/net/%s\n", 3451 ": Warning: cannot create /proc/net/%s\n",
3464 DRV_NAME); 3452 DRV_NAME);
3465 }
3466 } 3453 }
3467} 3454}
3468 3455
@@ -3471,25 +3458,7 @@ static void bond_create_proc_dir(void)
3471 */ 3458 */
3472static void bond_destroy_proc_dir(void) 3459static void bond_destroy_proc_dir(void)
3473{ 3460{
3474 struct proc_dir_entry *de; 3461 if (bond_proc_dir) {
3475
3476 if (!bond_proc_dir) {
3477 return;
3478 }
3479
3480 /* verify that the /proc dir is empty */
3481 for (de = bond_proc_dir->subdir; de; de = de->next) {
3482 /* ignore . and .. */
3483 if (*(de->name) != '.') {
3484 break;
3485 }
3486 }
3487
3488 if (de) {
3489 if (bond_proc_dir->owner == THIS_MODULE) {
3490 bond_proc_dir->owner = NULL;
3491 }
3492 } else {
3493 remove_proc_entry(DRV_NAME, init_net.proc_net); 3462 remove_proc_entry(DRV_NAME, init_net.proc_net);
3494 bond_proc_dir = NULL; 3463 bond_proc_dir = NULL;
3495 } 3464 }
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index 1243bc8e0035..ac0e4b6b6b66 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -1871,13 +1871,6 @@ static int __init vlsi_mod_init(void)
1871 * without procfs - it's not required for the driver to work. 1871 * without procfs - it's not required for the driver to work.
1872 */ 1872 */
1873 vlsi_proc_root = proc_mkdir(PROC_DIR, NULL); 1873 vlsi_proc_root = proc_mkdir(PROC_DIR, NULL);
1874 if (vlsi_proc_root) {
1875 /* protect registered procdir against module removal.
1876 * Because we are in the module init path there's no race
1877 * window after create_proc_entry (and no barrier needed).
1878 */
1879 vlsi_proc_root->owner = THIS_MODULE;
1880 }
1881 1874
1882 ret = pci_register_driver(&vlsi_irda_driver); 1875 ret = pci_register_driver(&vlsi_irda_driver);
1883 1876
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 7e80aba8a148..31b1cc2b778a 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -4494,7 +4494,6 @@ static int setup_proc_entry( struct net_device *dev,
4494 goto fail; 4494 goto fail;
4495 apriv->proc_entry->uid = proc_uid; 4495 apriv->proc_entry->uid = proc_uid;
4496 apriv->proc_entry->gid = proc_gid; 4496 apriv->proc_entry->gid = proc_gid;
4497 apriv->proc_entry->owner = THIS_MODULE;
4498 4497
4499 /* Setup the StatsDelta */ 4498 /* Setup the StatsDelta */
4500 entry = proc_create_data("StatsDelta", 4499 entry = proc_create_data("StatsDelta",
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();
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c
index 0c6257a034ff..c086fc30a84c 100644
--- a/drivers/rtc/rtc-proc.c
+++ b/drivers/rtc/rtc-proc.c
@@ -105,14 +105,8 @@ static const struct file_operations rtc_proc_fops = {
105 105
106void rtc_proc_add_device(struct rtc_device *rtc) 106void rtc_proc_add_device(struct rtc_device *rtc)
107{ 107{
108 if (rtc->id == 0) { 108 if (rtc->id == 0)
109 struct proc_dir_entry *ent; 109 proc_create_data("driver/rtc", 0, NULL, &rtc_proc_fops, rtc);
110
111 ent = proc_create_data("driver/rtc", 0, NULL,
112 &rtc_proc_fops, rtc);
113 if (ent)
114 ent->owner = rtc->owner;
115 }
116} 110}
117 111
118void rtc_proc_del_device(struct rtc_device *rtc) 112void rtc_proc_del_device(struct rtc_device *rtc)
diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c
index 2080ba6a69b0..654daa3cdfda 100644
--- a/drivers/s390/block/dasd_proc.c
+++ b/drivers/s390/block/dasd_proc.c
@@ -320,7 +320,6 @@ dasd_proc_init(void)
320 dasd_proc_root_entry = proc_mkdir("dasd", NULL); 320 dasd_proc_root_entry = proc_mkdir("dasd", NULL);
321 if (!dasd_proc_root_entry) 321 if (!dasd_proc_root_entry)
322 goto out_nodasd; 322 goto out_nodasd;
323 dasd_proc_root_entry->owner = THIS_MODULE;
324 dasd_devices_entry = proc_create("devices", 323 dasd_devices_entry = proc_create("devices",
325 S_IFREG | S_IRUGO | S_IWUSR, 324 S_IFREG | S_IRUGO | S_IWUSR,
326 dasd_proc_root_entry, 325 dasd_proc_root_entry,
@@ -334,7 +333,6 @@ dasd_proc_init(void)
334 goto out_nostatistics; 333 goto out_nostatistics;
335 dasd_statistics_entry->read_proc = dasd_statistics_read; 334 dasd_statistics_entry->read_proc = dasd_statistics_read;
336 dasd_statistics_entry->write_proc = dasd_statistics_write; 335 dasd_statistics_entry->write_proc = dasd_statistics_write;
337 dasd_statistics_entry->owner = THIS_MODULE;
338 return 0; 336 return 0;
339 337
340 out_nostatistics: 338 out_nostatistics:
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 099b5455bbce..b13481369642 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -596,8 +596,6 @@ int __init scsi_init_devinfo(void)
596 error = -ENOMEM; 596 error = -ENOMEM;
597 goto out; 597 goto out;
598 } 598 }
599
600 p->owner = THIS_MODULE;
601#endif /* CONFIG_SCSI_PROC_FS */ 599#endif /* CONFIG_SCSI_PROC_FS */
602 600
603 out: 601 out:
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 82f7b2dd08a2..77fbddb507fd 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -115,8 +115,6 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht)
115 if (!sht->proc_dir) 115 if (!sht->proc_dir)
116 printk(KERN_ERR "%s: proc_mkdir failed for %s\n", 116 printk(KERN_ERR "%s: proc_mkdir failed for %s\n",
117 __func__, sht->proc_name); 117 __func__, sht->proc_name);
118 else
119 sht->proc_dir->owner = sht->module;
120 } 118 }
121 mutex_unlock(&global_host_template_mutex); 119 mutex_unlock(&global_host_template_mutex);
122} 120}
@@ -163,7 +161,6 @@ void scsi_proc_host_add(struct Scsi_Host *shost)
163 } 161 }
164 162
165 p->write_proc = proc_scsi_write_proc; 163 p->write_proc = proc_scsi_write_proc;
166 p->owner = sht->module;
167} 164}
168 165
169/** 166/**
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 37b433a08ce8..e327b84820d2 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -2059,25 +2059,21 @@ static void viafb_init_proc(struct proc_dir_entry **viafb_entry)
2059 if (viafb_entry) { 2059 if (viafb_entry) {
2060 entry = create_proc_entry("dvp0", 0, *viafb_entry); 2060 entry = create_proc_entry("dvp0", 0, *viafb_entry);
2061 if (entry) { 2061 if (entry) {
2062 entry->owner = THIS_MODULE;
2063 entry->read_proc = viafb_dvp0_proc_read; 2062 entry->read_proc = viafb_dvp0_proc_read;
2064 entry->write_proc = viafb_dvp0_proc_write; 2063 entry->write_proc = viafb_dvp0_proc_write;
2065 } 2064 }
2066 entry = create_proc_entry("dvp1", 0, *viafb_entry); 2065 entry = create_proc_entry("dvp1", 0, *viafb_entry);
2067 if (entry) { 2066 if (entry) {
2068 entry->owner = THIS_MODULE;
2069 entry->read_proc = viafb_dvp1_proc_read; 2067 entry->read_proc = viafb_dvp1_proc_read;
2070 entry->write_proc = viafb_dvp1_proc_write; 2068 entry->write_proc = viafb_dvp1_proc_write;
2071 } 2069 }
2072 entry = create_proc_entry("dfph", 0, *viafb_entry); 2070 entry = create_proc_entry("dfph", 0, *viafb_entry);
2073 if (entry) { 2071 if (entry) {
2074 entry->owner = THIS_MODULE;
2075 entry->read_proc = viafb_dfph_proc_read; 2072 entry->read_proc = viafb_dfph_proc_read;
2076 entry->write_proc = viafb_dfph_proc_write; 2073 entry->write_proc = viafb_dfph_proc_write;
2077 } 2074 }
2078 entry = create_proc_entry("dfpl", 0, *viafb_entry); 2075 entry = create_proc_entry("dfpl", 0, *viafb_entry);
2079 if (entry) { 2076 if (entry) {
2080 entry->owner = THIS_MODULE;
2081 entry->read_proc = viafb_dfpl_proc_read; 2077 entry->read_proc = viafb_dfpl_proc_read;
2082 entry->write_proc = viafb_dfpl_proc_write; 2078 entry->write_proc = viafb_dfpl_proc_write;
2083 } 2079 }
@@ -2086,7 +2082,6 @@ static void viafb_init_proc(struct proc_dir_entry **viafb_entry)
2086 viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) { 2082 viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) {
2087 entry = create_proc_entry("vt1636", 0, *viafb_entry); 2083 entry = create_proc_entry("vt1636", 0, *viafb_entry);
2088 if (entry) { 2084 if (entry) {
2089 entry->owner = THIS_MODULE;
2090 entry->read_proc = viafb_vt1636_proc_read; 2085 entry->read_proc = viafb_vt1636_proc_read;
2091 entry->write_proc = viafb_vt1636_proc_write; 2086 entry->write_proc = viafb_vt1636_proc_write;
2092 } 2087 }