]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
proc 2/2: remove struct proc_dir_entry::owner
authorAlexey Dobriyan <adobriyan@gmail.com>
Wed, 25 Mar 2009 19:48:06 +0000 (22:48 +0300)
committerAlexey Dobriyan <adobriyan@gmail.com>
Mon, 30 Mar 2009 21:14:44 +0000 (01:14 +0400)
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>
55 files changed:
Documentation/DocBook/procfs_example.c
arch/alpha/kernel/srm_env.c
arch/blackfin/mm/sram-alloc.c
arch/ia64/kernel/palinfo.c
arch/ia64/sn/kernel/sn2/prominfo_proc.c
arch/powerpc/kernel/rtas_flash.c
arch/sparc/kernel/led.c
arch/x86/kernel/cpu/mtrr/if.c
drivers/acpi/ac.c
drivers/acpi/battery.c
drivers/acpi/button.c
drivers/acpi/fan.c
drivers/acpi/processor_core.c
drivers/acpi/sbs.c
drivers/acpi/thermal.c
drivers/acpi/video.c
drivers/block/ps3vram.c
drivers/char/ipmi/ipmi_msghandler.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/input/input.c
drivers/isdn/hardware/eicon/divasi.c
drivers/media/video/cpia.c
drivers/message/i2o/i2o_proc.c
drivers/net/bonding/bond_main.c
drivers/net/irda/vlsi_ir.c
drivers/net/wireless/airo.c
drivers/platform/x86/asus_acpi.c
drivers/platform/x86/thinkpad_acpi.c
drivers/platform/x86/toshiba_acpi.c
drivers/rtc/rtc-proc.c
drivers/s390/block/dasd_proc.c
drivers/scsi/scsi_devinfo.c
drivers/scsi/scsi_proc.c
drivers/video/via/viafbdev.c
fs/afs/proc.c
fs/cifs/cifs_debug.c
fs/jfs/jfs_debug.c
fs/nfs/client.c
fs/proc/inode.c
fs/proc/proc_tty.c
fs/reiserfs/procfs.c
include/linux/ipmi_smi.h
include/linux/proc_fs.h
net/appletalk/atalk_proc.c
net/atm/mpoa_proc.c
net/atm/proc.c
net/can/bcm.c
net/can/proc.c
net/core/pktgen.c
net/irda/irproc.c
net/llc/llc_proc.c
net/sctp/protocol.c
net/sunrpc/cache.c
net/sunrpc/stats.c
sound/core/info.c

index 8c6396e4bf311901a19fd717500c422eeba4869a..a5b11793b1e0167bf32d1b1a19d13aca7a424aa5 100644 (file)
@@ -117,9 +117,6 @@ static int __init init_procfs_example(void)
                rv = -ENOMEM;
                goto out;
        }
-       
-       example_dir->owner = THIS_MODULE;
-       
        /* create jiffies using convenience function */
        jiffies_file = create_proc_read_entry("jiffies", 
                                              0444, example_dir, 
@@ -130,8 +127,6 @@ static int __init init_procfs_example(void)
                goto no_jiffies;
        }
 
-       jiffies_file->owner = THIS_MODULE;
-
        /* create foo and bar files using same callback
         * functions 
         */
@@ -146,7 +141,6 @@ static int __init init_procfs_example(void)
        foo_file->data = &foo_data;
        foo_file->read_proc = proc_read_foobar;
        foo_file->write_proc = proc_write_foobar;
-       foo_file->owner = THIS_MODULE;
                
        bar_file = create_proc_entry("bar", 0644, example_dir);
        if(bar_file == NULL) {
@@ -159,7 +153,6 @@ static int __init init_procfs_example(void)
        bar_file->data = &bar_data;
        bar_file->read_proc = proc_read_foobar;
        bar_file->write_proc = proc_write_foobar;
-       bar_file->owner = THIS_MODULE;
                
        /* create symlink */
        symlink = proc_symlink("jiffies_too", example_dir, 
@@ -169,8 +162,6 @@ static int __init init_procfs_example(void)
                goto no_symlink;
        }
 
-       symlink->owner = THIS_MODULE;
-
        /* everything OK */
        printk(KERN_INFO "%s %s initialised\n",
               MODULE_NAME, MODULE_VERS);
index 78ad7cd1bbd60326d38bee8f00c8beb6a55f03eb..d12af472e1c0ec4aa380e8bdc73aab15627d7a2c 100644 (file)
@@ -218,7 +218,6 @@ srm_env_init(void)
                                BASE_DIR);
                goto cleanup;
        }
-       base_dir->owner = THIS_MODULE;
 
        /*
         * Create per-name subdirectory
@@ -229,7 +228,6 @@ srm_env_init(void)
                                BASE_DIR, NAMED_DIR);
                goto cleanup;
        }
-       named_dir->owner = THIS_MODULE;
 
        /*
         * Create per-number subdirectory
@@ -241,7 +239,6 @@ srm_env_init(void)
                goto cleanup;
 
        }
-       numbered_dir->owner = THIS_MODULE;
 
        /*
         * Create all named nodes
@@ -254,7 +251,6 @@ srm_env_init(void)
                        goto cleanup;
 
                entry->proc_entry->data         = (void *) entry;
-               entry->proc_entry->owner        = THIS_MODULE;
                entry->proc_entry->read_proc    = srm_env_read;
                entry->proc_entry->write_proc   = srm_env_write;
 
@@ -275,7 +271,6 @@ srm_env_init(void)
 
                entry->id                       = var_num;
                entry->proc_entry->data         = (void *) entry;
-               entry->proc_entry->owner        = THIS_MODULE;
                entry->proc_entry->read_proc    = srm_env_read;
                entry->proc_entry->write_proc   = srm_env_write;
        }
index 834cab7438a8fa3293f2c8e1ef4269c6740d8e13..530d1393a23226926c80ef833dd6b32230405214 100644 (file)
@@ -854,7 +854,6 @@ static int __init sram_proc_init(void)
                printk(KERN_WARNING "unable to create /proc/sram\n");
                return -1;
        }
-       ptr->owner = THIS_MODULE;
        ptr->read_proc = sram_proc_read;
        return 0;
 }
index e5c57f413ca27b197ef0edeb2166efde99d113cb..a4f19c70aadd39d95878740ecc92905c94d4270e 100644 (file)
@@ -1002,8 +1002,6 @@ create_palinfo_proc_entries(unsigned int cpu)
                *pdir = create_proc_read_entry(
                                palinfo_entries[j].name, 0, cpu_dir,
                                palinfo_read_entry, (void *)f.value);
-               if (*pdir)
-                       (*pdir)->owner = THIS_MODULE;
                pdir++;
        }
 }
index 4dcce3d0e04ca1c9bc0e10d10cf4d7fcab6f7723..e6332881864374111440c339a0da72e55130ff40 100644 (file)
@@ -225,7 +225,6 @@ static struct proc_dir_entry *sgi_prominfo_entry;
 int __init prominfo_init(void)
 {
        struct proc_dir_entry **entp;
-       struct proc_dir_entry *p;
        cnodeid_t cnodeid;
        unsigned long nasid;
        int size;
@@ -246,14 +245,10 @@ int __init prominfo_init(void)
                sprintf(name, "node%d", cnodeid);
                *entp = proc_mkdir(name, sgi_prominfo_entry);
                nasid = cnodeid_to_nasid(cnodeid);
-               p = create_proc_read_entry("fit", 0, *entp, read_fit_entry,
+               create_proc_read_entry("fit", 0, *entp, read_fit_entry,
                                           (void *)nasid);
-               if (p)
-                       p->owner = THIS_MODULE;
-               p = create_proc_read_entry("version", 0, *entp,
+               create_proc_read_entry("version", 0, *entp,
                                           read_version_entry, (void *)nasid);
-               if (p)
-                       p->owner = THIS_MODULE;
                entp++;
        }
 
index 149cb112cd1ad398357d33ae766e3add6c6cfc01..13011a96a9779b274e77447dd5b72dae4e56142a 100644 (file)
@@ -669,7 +669,6 @@ static void remove_flash_pde(struct proc_dir_entry *dp)
 {
        if (dp) {
                kfree(dp->data);
-               dp->owner = NULL;
                remove_proc_entry(dp->name, dp->parent);
        }
 }
index adaaed4ea2fb6821ca2a85c7afe61d2a07208f1d..00d034ea2164d63148d7b0ff04538420b163c513 100644 (file)
@@ -126,7 +126,6 @@ static int __init led_init(void)
        led = proc_create("led", 0, NULL, &led_proc_fops);
        if (!led)
                return -ENOMEM;
-       led->owner = THIS_MODULE;
 
        printk(KERN_INFO
               "led: version %s, Lars Kotthoff <metalhead@metalhead.ws>\n",
index 4c4214690dd10a4c32fc787e03bce6e7cba315d9..fb73a52913a4f883ca42010de302e3e909189fe7 100644 (file)
@@ -377,10 +377,6 @@ static const struct file_operations mtrr_fops = {
        .release = mtrr_close,
 };
 
-
-static struct proc_dir_entry *proc_root_mtrr;
-
-
 static int mtrr_seq_show(struct seq_file *seq, void *offset)
 {
        char factor;
@@ -423,11 +419,7 @@ static int __init mtrr_if_init(void)
            (!cpu_has(c, X86_FEATURE_CENTAUR_MCR)))
                return -ENODEV;
 
-       proc_root_mtrr =
-               proc_create("mtrr", S_IWUSR | S_IRUGO, NULL, &mtrr_fops);
-
-       if (proc_root_mtrr)
-               proc_root_mtrr->owner = THIS_MODULE;
+       proc_create("mtrr", S_IWUSR | S_IRUGO, NULL, &mtrr_fops);
        return 0;
 }
 
index 9b917dac77322b4aa397549aa4874ed0c4ad8dab..88e42abf5d881b8bf443ecc4f58e3b4e76b3ecd3 100644 (file)
@@ -191,7 +191,6 @@ static int acpi_ac_add_fs(struct acpi_device *device)
                                                     acpi_ac_dir);
                if (!acpi_device_dir(device))
                        return -ENODEV;
-               acpi_device_dir(device)->owner = THIS_MODULE;
        }
 
        /* 'state' [R] */
index 69cbc57c2d1cd248e7431bb40661e9ea139efbb7..3bcb5bfc45d3366645bfdf6a417d6c140e30107d 100644 (file)
@@ -760,7 +760,6 @@ static int acpi_battery_add_fs(struct acpi_device *device)
                                                     acpi_battery_dir);
                if (!acpi_device_dir(device))
                        return -ENODEV;
-               acpi_device_dir(device)->owner = THIS_MODULE;
        }
 
        for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) {
index 171fd914f43533f46bf417dd4d4a7b6936fc6e50..c2f06069dcd40d614a20c0a5e3a2883d47535a9a 100644 (file)
@@ -200,12 +200,10 @@ static int acpi_button_add_fs(struct acpi_device *device)
 
        if (!entry)
                return -ENODEV;
-       entry->owner = THIS_MODULE;
 
        acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
        if (!acpi_device_dir(device))
                return -ENODEV;
-       acpi_device_dir(device)->owner = THIS_MODULE;
 
        /* 'info' [R] */
        entry = proc_create_data(ACPI_BUTTON_FILE_INFO,
@@ -522,7 +520,6 @@ static int __init acpi_button_init(void)
        acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
        if (!acpi_button_dir)
                return -ENODEV;
-       acpi_button_dir->owner = THIS_MODULE;
        result = acpi_bus_register_driver(&acpi_button_driver);
        if (result < 0) {
                remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
index eaaee1660bdf41ec490696b812b2c17869daffe9..8a02944bf92d687e4b1cf5c3e79b8efce59c9d6a 100644 (file)
@@ -193,7 +193,6 @@ static int acpi_fan_add_fs(struct acpi_device *device)
                                                     acpi_fan_dir);
                if (!acpi_device_dir(device))
                        return -ENODEV;
-               acpi_device_dir(device)->owner = THIS_MODULE;
        }
 
        /* 'status' [R/W] */
@@ -347,7 +346,6 @@ static int __init acpi_fan_init(void)
        acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
        if (!acpi_fan_dir)
                return -ENODEV;
-       acpi_fan_dir->owner = THIS_MODULE;
 #endif
 
        result = acpi_bus_register_driver(&acpi_fan_driver);
index 0cc2fd31e3765f7c9b945460345533dfebf1424b..fa2f7422d23de1e2bec5ee3702fa15e2a5ca284c 100644 (file)
@@ -359,7 +359,6 @@ static int acpi_processor_add_fs(struct acpi_device *device)
                if (!acpi_device_dir(device))
                        return -ENODEV;
        }
-       acpi_device_dir(device)->owner = THIS_MODULE;
 
        /* 'info' [R] */
        entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO,
@@ -1137,7 +1136,6 @@ static int __init acpi_processor_init(void)
        acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
        if (!acpi_processor_dir)
                return -ENOMEM;
-       acpi_processor_dir->owner = THIS_MODULE;
 
        /*
         * Check whether the system is DMI table. If yes, OSPM
index 6050ce4818731fd2bcf8c6891d5a343414d0133a..59afd52ccc121aace5b3d47b56442d718901a090 100644 (file)
@@ -488,7 +488,6 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
                if (!*dir) {
                        return -ENODEV;
                }
-               (*dir)->owner = THIS_MODULE;
        }
 
        /* 'info' [R] */
index 99e6f1f8ea457677e1b989c711e37e1b339e60c3..c11f9aeca706f88b164d932d15e88886b070615b 100644 (file)
@@ -1506,7 +1506,6 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
                                                     acpi_thermal_dir);
                if (!acpi_device_dir(device))
                        return -ENODEV;
-               acpi_device_dir(device)->owner = THIS_MODULE;
        }
 
        /* 'state' [R] */
@@ -1875,7 +1874,6 @@ static int __init acpi_thermal_init(void)
        acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
        if (!acpi_thermal_dir)
                return -ENODEV;
-       acpi_thermal_dir->owner = THIS_MODULE;
 
        result = acpi_bus_register_driver(&acpi_thermal_driver);
        if (result < 0) {
index bb5ed059114aa296e826b91f8b35083ccc773028..67cc36dc9b82fe94b7430628076191e3a6246894 100644 (file)
@@ -1125,8 +1125,6 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
        if (!device_dir)
                return -ENOMEM;
 
-       device_dir->owner = THIS_MODULE;
-
        /* 'info' [R] */
        entry = proc_create_data("info", S_IRUGO, device_dir,
                        &acpi_video_device_info_fops, acpi_driver_data(device));
@@ -1403,8 +1401,6 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
        if (!device_dir)
                return -ENOMEM;
 
-       device_dir->owner = THIS_MODULE;
-
        /* 'info' [R] */
        entry = proc_create_data("info", S_IRUGO, device_dir,
                                 &acpi_video_bus_info_fops,
@@ -2131,7 +2127,6 @@ static int __init acpi_video_init(void)
        acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
        if (!acpi_video_dir)
                return -ENODEV;
-       acpi_video_dir->owner = THIS_MODULE;
 
        result = acpi_bus_register_driver(&acpi_video_bus);
        if (result < 0) {
index 393ed6760d783c155a2a0846d8de03c505167057..8eddef373a9197d9db8834d5ba15d1f743b85ee2 100644 (file)
@@ -551,8 +551,6 @@ static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev)
                dev_warn(&dev->core, "failed to create /proc entry\n");
                return;
        }
-
-       pde->owner = THIS_MODULE;
        pde->data = priv;
 }
 
index 7a88dfd4427b136c6e034b06d4f6e6e3a416cd39..e93fc8d22fb2b839413dacd50fda823c060f7989 100644 (file)
@@ -1944,7 +1944,7 @@ static int stat_file_read_proc(char *page, char **start, off_t off,
 
 int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
                            read_proc_t *read_proc,
-                           void *data, struct module *owner)
+                           void *data)
 {
        int                    rv = 0;
 #ifdef CONFIG_PROC_FS
@@ -1970,7 +1970,6 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
        } else {
                file->data = data;
                file->read_proc = read_proc;
-               file->owner = owner;
 
                mutex_lock(&smi->proc_entry_lock);
                /* Stick it on the list. */
@@ -1993,23 +1992,21 @@ static int add_proc_entries(ipmi_smi_t smi, int num)
        smi->proc_dir = proc_mkdir(smi->proc_dir_name, proc_ipmi_root);
        if (!smi->proc_dir)
                rv = -ENOMEM;
-       else
-               smi->proc_dir->owner = THIS_MODULE;
 
        if (rv == 0)
                rv = ipmi_smi_add_proc_entry(smi, "stats",
                                             stat_file_read_proc,
-                                            smi, THIS_MODULE);
+                                            smi);
 
        if (rv == 0)
                rv = ipmi_smi_add_proc_entry(smi, "ipmb",
                                             ipmb_file_read_proc,
-                                            smi, THIS_MODULE);
+                                            smi);
 
        if (rv == 0)
                rv = ipmi_smi_add_proc_entry(smi, "version",
                                             version_file_read_proc,
-                                            smi, THIS_MODULE);
+                                            smi);
 #endif /* CONFIG_PROC_FS */
 
        return rv;
@@ -4265,7 +4262,6 @@ static int ipmi_init_msghandler(void)
            return -ENOMEM;
        }
 
-       proc_ipmi_root->owner = THIS_MODULE;
 #endif /* CONFIG_PROC_FS */
 
        setup_timer(&ipmi_timer, ipmi_timeout, 0);
index 3000135f2ead3bcd98cd505b7fa89f11d0d2ab5e..e58ea4cd55ce02a101f282dd5977be4417b41bf4 100644 (file)
@@ -2899,7 +2899,7 @@ static int try_smi_init(struct smi_info *new_smi)
 
        rv = ipmi_smi_add_proc_entry(new_smi->intf, "type",
                                     type_file_read_proc,
-                                    new_smi, THIS_MODULE);
+                                    new_smi);
        if (rv) {
                printk(KERN_ERR
                       "ipmi_si: Unable to create proc entry: %d\n",
@@ -2909,7 +2909,7 @@ static int try_smi_init(struct smi_info *new_smi)
 
        rv = ipmi_smi_add_proc_entry(new_smi->intf, "si_stats",
                                     stat_file_read_proc,
-                                    new_smi, THIS_MODULE);
+                                    new_smi);
        if (rv) {
                printk(KERN_ERR
                       "ipmi_si: Unable to create proc entry: %d\n",
@@ -2919,7 +2919,7 @@ static int try_smi_init(struct smi_info *new_smi)
 
        rv = ipmi_smi_add_proc_entry(new_smi->intf, "params",
                                     param_read_proc,
-                                    new_smi, THIS_MODULE);
+                                    new_smi);
        if (rv) {
                printk(KERN_ERR
                       "ipmi_si: Unable to create proc entry: %d\n",
index 1730d7331a5dff13a6841fd0009066f49cde6666..ec3db3ade1182b01ef663a946c85de10efa54023 100644 (file)
@@ -903,8 +903,6 @@ static int __init input_proc_init(void)
        if (!proc_bus_input_dir)
                return -ENOMEM;
 
-       proc_bus_input_dir->owner = THIS_MODULE;
-
        entry = proc_create("devices", 0, proc_bus_input_dir,
                            &input_devices_fileops);
        if (!entry)
index f4969fe0a0554ad5f567268075be2a6e90b34bb1..69e71ebe7841830bf2af1dc68b894186b776cb91 100644 (file)
@@ -118,7 +118,6 @@ static int DIVA_INIT_FUNCTION create_um_idi_proc(void)
                return (0);
 
        um_idi_proc_entry->read_proc = um_idi_proc_read;
-       um_idi_proc_entry->owner = THIS_MODULE;
 
        return (1);
 }
index c3b0c8c63c7642601a2b14feceb5a1f55ff86a78..43ab0adf3b610a8927299e833c6bb3ab5f3b73ad 100644 (file)
@@ -1381,9 +1381,7 @@ static void proc_cpia_create(void)
 {
        cpia_proc_root = proc_mkdir("cpia", NULL);
 
-       if (cpia_proc_root)
-               cpia_proc_root->owner = THIS_MODULE;
-       else
+       if (!cpia_proc_root)
                LOG("Unable to initialise /proc/cpia\n");
 }
 
index 9a36b5a7de5736365f356190877a6947f2048246..7045c45da9b160030fdd07859b373708656d2ea0 100644 (file)
@@ -2037,8 +2037,6 @@ static int __init i2o_proc_fs_create(void)
        if (!i2o_proc_dir_root)
                return -1;
 
-       i2o_proc_dir_root->owner = THIS_MODULE;
-
        list_for_each_entry(c, &i2o_controllers, list)
            i2o_proc_iop_add(i2o_proc_dir_root, c);
 
index 9c326a50a3eecb22851cc21ecb5f3d3a3e861e5b..99610f358c40629cecf9a12dfbc2566587a5026d 100644 (file)
@@ -3444,25 +3444,12 @@ static void bond_remove_proc_entry(struct bonding *bond)
  */
 static void bond_create_proc_dir(void)
 {
-       int len = strlen(DRV_NAME);
-
-       for (bond_proc_dir = init_net.proc_net->subdir; bond_proc_dir;
-            bond_proc_dir = bond_proc_dir->next) {
-               if ((bond_proc_dir->namelen == len) &&
-                   !memcmp(bond_proc_dir->name, DRV_NAME, len)) {
-                       break;
-               }
-       }
-
        if (!bond_proc_dir) {
                bond_proc_dir = proc_mkdir(DRV_NAME, init_net.proc_net);
-               if (bond_proc_dir) {
-                       bond_proc_dir->owner = THIS_MODULE;
-               } else {
+               if (!bond_proc_dir)
                        printk(KERN_WARNING DRV_NAME
                                ": Warning: cannot create /proc/net/%s\n",
                                DRV_NAME);
-               }
        }
 }
 
@@ -3471,25 +3458,7 @@ static void bond_create_proc_dir(void)
  */
 static void bond_destroy_proc_dir(void)
 {
-       struct proc_dir_entry *de;
-
-       if (!bond_proc_dir) {
-               return;
-       }
-
-       /* verify that the /proc dir is empty */
-       for (de = bond_proc_dir->subdir; de; de = de->next) {
-               /* ignore . and .. */
-               if (*(de->name) != '.') {
-                       break;
-               }
-       }
-
-       if (de) {
-               if (bond_proc_dir->owner == THIS_MODULE) {
-                       bond_proc_dir->owner = NULL;
-               }
-       } else {
+       if (bond_proc_dir) {
                remove_proc_entry(DRV_NAME, init_net.proc_net);
                bond_proc_dir = NULL;
        }
index 1243bc8e0035877dd2edf703b96edfbacdaaa54b..ac0e4b6b6b66793ca8fd16b2ffff4818975c2a28 100644 (file)
@@ -1871,13 +1871,6 @@ static int __init vlsi_mod_init(void)
         * without procfs - it's not required for the driver to work.
         */
        vlsi_proc_root = proc_mkdir(PROC_DIR, NULL);
-       if (vlsi_proc_root) {
-               /* protect registered procdir against module removal.
-                * Because we are in the module init path there's no race
-                * window after create_proc_entry (and no barrier needed).
-                */
-               vlsi_proc_root->owner = THIS_MODULE;
-       }
 
        ret = pci_register_driver(&vlsi_irda_driver);
 
index 7e80aba8a148dbb821e6096181378f3768f4455a..31b1cc2b778ab08c94215a2a27b4cde1bbc0eab2 100644 (file)
@@ -4494,7 +4494,6 @@ static int setup_proc_entry( struct net_device *dev,
                goto fail;
        apriv->proc_entry->uid = proc_uid;
        apriv->proc_entry->gid = proc_gid;
-       apriv->proc_entry->owner = THIS_MODULE;
 
        /* Setup the StatsDelta */
        entry = proc_create_data("StatsDelta",
index d63f26e666a4c0c369d340f7f90646d48a814c59..ba1f7497e4b9a99f5be8d9d9d406ff1f6b170dbd 100644 (file)
@@ -987,7 +987,6 @@ asus_proc_add(char *name, proc_writefunc *writefunc,
        proc->write_proc = writefunc;
        proc->read_proc = readfunc;
        proc->data = acpi_driver_data(device);
-       proc->owner = THIS_MODULE;
        proc->uid = asus_uid;
        proc->gid = asus_gid;
        return 0;
@@ -1020,7 +1019,6 @@ static int asus_hotk_add_fs(struct acpi_device *device)
        if (proc) {
                proc->read_proc = proc_read_info;
                proc->data = acpi_driver_data(device);
-               proc->owner = THIS_MODULE;
                proc->uid = asus_uid;
                proc->gid = asus_gid;
        } else {
@@ -1436,7 +1434,6 @@ static int __init asus_acpi_init(void)
                printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n");
                return -ENODEV;
        }
-       asus_proc_dir->owner = THIS_MODULE;
 
        result = acpi_bus_register_driver(&asus_hotk_driver);
        if (result < 0) {
index d2433204a40c056721d76c9f8bc2798e43feeb04..3dad27a385d3b27e90c80a229927db11b47cc9e5 100644 (file)
@@ -6992,7 +6992,6 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
                        ret = -ENODEV;
                        goto err_out;
                }
-               entry->owner = THIS_MODULE;
                entry->data = ibm;
                entry->read_proc = &dispatch_procfs_read;
                if (ibm->write)
@@ -7405,7 +7404,6 @@ static int __init thinkpad_acpi_module_init(void)
                thinkpad_acpi_module_exit();
                return -ENODEV;
        }
-       proc_dir->owner = THIS_MODULE;
 
        ret = platform_driver_register(&tpacpi_pdriver);
        if (ret) {
index 40e60fc2e596daead5c656396aa84fca0587868b..9f187265db8e260d201b167bc0095e8bd4757765 100644 (file)
@@ -679,8 +679,6 @@ static acpi_status __init add_device(void)
                                              toshiba_proc_dir,
                                              (read_proc_t *) dispatch_read,
                                              item);
-               if (proc)
-                       proc->owner = THIS_MODULE;
                if (proc && item->write_func)
                        proc->write_proc = (write_proc_t *) dispatch_write;
        }
@@ -772,7 +770,6 @@ static int __init toshiba_acpi_init(void)
                toshiba_acpi_exit();
                return -ENODEV;
        } else {
-               toshiba_proc_dir->owner = THIS_MODULE;
                status = add_device();
                if (ACPI_FAILURE(status)) {
                        toshiba_acpi_exit();
index 0c6257a034ff07b3dc85e9ce1db3847571c97fc4..c086fc30a84c9ad3b4e834559a4d433688758a1a 100644 (file)
@@ -105,14 +105,8 @@ static const struct file_operations rtc_proc_fops = {
 
 void rtc_proc_add_device(struct rtc_device *rtc)
 {
-       if (rtc->id == 0) {
-               struct proc_dir_entry *ent;
-
-               ent = proc_create_data("driver/rtc", 0, NULL,
-                                      &rtc_proc_fops, rtc);
-               if (ent)
-                       ent->owner = rtc->owner;
-       }
+       if (rtc->id == 0)
+               proc_create_data("driver/rtc", 0, NULL, &rtc_proc_fops, rtc);
 }
 
 void rtc_proc_del_device(struct rtc_device *rtc)
index 2080ba6a69b0ea5b906c0a3bfc1c6ed639651b8b..654daa3cdfda7bcb60ad0f51e4748c8ffdfd0da1 100644 (file)
@@ -320,7 +320,6 @@ dasd_proc_init(void)
        dasd_proc_root_entry = proc_mkdir("dasd", NULL);
        if (!dasd_proc_root_entry)
                goto out_nodasd;
-       dasd_proc_root_entry->owner = THIS_MODULE;
        dasd_devices_entry = proc_create("devices",
                                         S_IFREG | S_IRUGO | S_IWUSR,
                                         dasd_proc_root_entry,
@@ -334,7 +333,6 @@ dasd_proc_init(void)
                goto out_nostatistics;
        dasd_statistics_entry->read_proc = dasd_statistics_read;
        dasd_statistics_entry->write_proc = dasd_statistics_write;
-       dasd_statistics_entry->owner = THIS_MODULE;
        return 0;
 
  out_nostatistics:
index 099b5455bbce287f60ef888566913616f13e9908..b13481369642f272c34d7e021f2c32365177fb7c 100644 (file)
@@ -596,8 +596,6 @@ int __init scsi_init_devinfo(void)
                error = -ENOMEM;
                goto out;
        }
-
-       p->owner = THIS_MODULE;
 #endif /* CONFIG_SCSI_PROC_FS */
 
  out:
index 82f7b2dd08a23e934aa4d6e08ce76e3c84ab1dc4..77fbddb507fdcb65b5d4fc940e6780ae756f6da9 100644 (file)
@@ -115,8 +115,6 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht)
                if (!sht->proc_dir)
                        printk(KERN_ERR "%s: proc_mkdir failed for %s\n",
                               __func__, sht->proc_name);
-               else
-                       sht->proc_dir->owner = sht->module;
        }
        mutex_unlock(&global_host_template_mutex);
 }
@@ -163,7 +161,6 @@ void scsi_proc_host_add(struct Scsi_Host *shost)
        } 
 
        p->write_proc = proc_scsi_write_proc;
-       p->owner = sht->module;
 }
 
 /**
index 37b433a08ce8fcaf893b47dcff8719ae4d4d6033..e327b84820d28fdb96c6eab1d74b2a08e78e67ab 100644 (file)
@@ -2059,25 +2059,21 @@ static void viafb_init_proc(struct proc_dir_entry **viafb_entry)
        if (viafb_entry) {
                entry = create_proc_entry("dvp0", 0, *viafb_entry);
                if (entry) {
-                       entry->owner = THIS_MODULE;
                        entry->read_proc = viafb_dvp0_proc_read;
                        entry->write_proc = viafb_dvp0_proc_write;
                }
                entry = create_proc_entry("dvp1", 0, *viafb_entry);
                if (entry) {
-                       entry->owner = THIS_MODULE;
                        entry->read_proc = viafb_dvp1_proc_read;
                        entry->write_proc = viafb_dvp1_proc_write;
                }
                entry = create_proc_entry("dfph", 0, *viafb_entry);
                if (entry) {
-                       entry->owner = THIS_MODULE;
                        entry->read_proc = viafb_dfph_proc_read;
                        entry->write_proc = viafb_dfph_proc_write;
                }
                entry = create_proc_entry("dfpl", 0, *viafb_entry);
                if (entry) {
-                       entry->owner = THIS_MODULE;
                        entry->read_proc = viafb_dfpl_proc_read;
                        entry->write_proc = viafb_dfpl_proc_write;
                }
@@ -2086,7 +2082,6 @@ static void viafb_init_proc(struct proc_dir_entry **viafb_entry)
                    viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) {
                        entry = create_proc_entry("vt1636", 0, *viafb_entry);
                        if (entry) {
-                               entry->owner = THIS_MODULE;
                                entry->read_proc = viafb_vt1636_proc_read;
                                entry->write_proc = viafb_vt1636_proc_write;
                        }
index 7578c1ab9e0be9ec3260c4cce41b78287f213bce..8630615e57fe512ca9c7a10472ce5f959f317234 100644 (file)
@@ -146,7 +146,6 @@ int afs_proc_init(void)
        proc_afs = proc_mkdir("fs/afs", NULL);
        if (!proc_afs)
                goto error_dir;
-       proc_afs->owner = THIS_MODULE;
 
        p = proc_create("cells", 0, proc_afs, &afs_proc_cells_fops);
        if (!p)
index 877e4d9a1159d11203170ec463202187dd3a6466..7f19fefd3d45a2790d426e68e59f80f687b4911c 100644 (file)
@@ -404,7 +404,6 @@ cifs_proc_init(void)
        if (proc_fs_cifs == NULL)
                return;
 
-       proc_fs_cifs->owner = THIS_MODULE;
        proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops);
 
 #ifdef CONFIG_CIFS_STATS
index 6a73de84bcef142350ad60f3b3fefe2b172de043..dd824d9b0b1a11877b2c901d335b2c746709bd08 100644 (file)
@@ -90,7 +90,6 @@ void jfs_proc_init(void)
 
        if (!(base = proc_mkdir("fs/jfs", NULL)))
                return;
-       base->owner = THIS_MODULE;
 
        for (i = 0; i < NPROCENT; i++)
                proc_create(Entries[i].name, 0, base, Entries[i].proc_fops);
index 574158ae2398aaeb1151d76f0a85f2b73871b976..2277421656e757a5b0132f2174c9a0a470dbf088 100644 (file)
@@ -1606,8 +1606,6 @@ int __init nfs_fs_proc_init(void)
        if (!proc_fs_nfs)
                goto error_0;
 
-       proc_fs_nfs->owner = THIS_MODULE;
-
        /* a file of servers with which we're dealing */
        p = proc_create("servers", S_IFREG|S_IRUGO,
                        proc_fs_nfs, &nfs_server_list_fops);
index e11dc22c6511b5641eb37a0393d44d006dd49413..d78ade305541d84a0a7b7682f203cd649c1e5a6a 100644 (file)
@@ -58,11 +58,8 @@ static void proc_delete_inode(struct inode *inode)
 
        /* Let go of any associated proc directory entry */
        de = PROC_I(inode)->pde;
-       if (de) {
-               if (de->owner)
-                       module_put(de->owner);
+       if (de)
                de_put(de);
-       }
        if (PROC_I(inode)->sysctl)
                sysctl_head_put(PROC_I(inode)->sysctl);
        clear_inode(inode);
@@ -449,12 +446,9 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
 {
        struct inode * inode;
 
-       if (!try_module_get(de->owner))
-               goto out_mod;
-
        inode = iget_locked(sb, ino);
        if (!inode)
-               goto out_ino;
+               return NULL;
        if (inode->i_state & I_NEW) {
                inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
                PROC_I(inode)->fd = 0;
@@ -485,16 +479,9 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
                        }
                }
                unlock_new_inode(inode);
-       } else {
-              module_put(de->owner);
+       } else
               de_put(de);
-       }
        return inode;
-
-out_ino:
-       module_put(de->owner);
-out_mod:
-       return NULL;
 }                      
 
 int proc_fill_super(struct super_block *s)
index d153946d6d15553223c563f901d12bd976c65832..4a9e0f65ae607732303f3b2a81fad46a9d28f4b0 100644 (file)
@@ -152,7 +152,6 @@ void proc_tty_register_driver(struct tty_driver *driver)
        if (!ent)
                return;
        ent->read_proc = driver->ops->read_proc;
-       ent->owner = driver->owner;
        ent->data = driver;
 
        driver->proc_entry = ent;
index d5066400638a5f5c292ae1eb83daae0871b7b256..9229e5514a4e13eef0fbaaef47f547bc90989a10 100644 (file)
@@ -492,7 +492,6 @@ int reiserfs_proc_info_init(struct super_block *sb)
        spin_lock_init(&__PINFO(sb).lock);
        REISERFS_SB(sb)->procdir = proc_mkdir(b, proc_info_root);
        if (REISERFS_SB(sb)->procdir) {
-               REISERFS_SB(sb)->procdir->owner = THIS_MODULE;
                REISERFS_SB(sb)->procdir->data = sb;
                add_file(sb, "version", show_version);
                add_file(sb, "super", show_super);
@@ -556,9 +555,7 @@ int reiserfs_proc_info_global_init(void)
 {
        if (proc_info_root == NULL) {
                proc_info_root = proc_mkdir(proc_info_root_name, NULL);
-               if (proc_info_root) {
-                       proc_info_root->owner = THIS_MODULE;
-               } else {
+               if (!proc_info_root) {
                        reiserfs_warning(NULL, "cannot create /proc/%s",
                                         proc_info_root_name);
                        return 1;
index 62b73668b60247c06da84bc8cca6919a9a34f6d6..f7c9c75a277547e7a6e8278d6f4da77a62eb3746 100644 (file)
@@ -230,6 +230,6 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg)
    automatically be dstroyed when the interface is destroyed. */
 int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
                            read_proc_t *read_proc,
-                           void *data, struct module *owner);
+                           void *data);
 
 #endif /* __LINUX_IPMI_SMI_H */
index b8bdb96eff78b8112ddf4717b651c4ef1126ead7..fbfa3d44d33d819ef6af58c95e136ed6cc7e594a 100644 (file)
@@ -41,9 +41,6 @@ enum {
  * while parent/subdir create the directory structure (every
  * /proc file has a parent, but "subdir" is NULL for all
  * non-directory entries).
- *
- * "owner" is used to protect module
- * from unloading while proc_dir_entry is in use
  */
 
 typedef        int (read_proc_t)(char *page, char **start, off_t off,
@@ -70,7 +67,6 @@ struct proc_dir_entry {
         * somewhere.
         */
        const struct file_operations *proc_fops;
-       struct module *owner;
        struct proc_dir_entry *next, *parent, *subdir;
        void *data;
        read_proc_t *read_proc;
index 162199a2d74f18e6b41ee7322c2ed8d66dfc4539..fd8e0847b25473ac9318aa22769af66500dbb073 100644 (file)
@@ -281,7 +281,6 @@ int __init atalk_proc_init(void)
        atalk_proc_dir = proc_mkdir("atalk", init_net.proc_net);
        if (!atalk_proc_dir)
                goto out;
-       atalk_proc_dir->owner = THIS_MODULE;
 
        p = proc_create("interface", S_IRUGO, atalk_proc_dir,
                        &atalk_seq_interface_fops);
index 4990541ef5da4ca7d0b2325bd39ebb4ffbf3c290..1a0f5ccea9c4494cad2c29755863f7dd0559e540 100644 (file)
@@ -281,7 +281,6 @@ int mpc_proc_init(void)
                printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME);
                return -ENOMEM;
        }
-       p->owner = THIS_MODULE;
        return 0;
 }
 
index 49487b313f221cf6394fa2c918fc67858ae1f45f..e7b3b273907d197b1a64ac8d1cd9c1ce0c3edc16 100644 (file)
@@ -476,7 +476,6 @@ int __init atm_proc_init(void)
                                     atm_proc_root, e->proc_fops);
                if (!dirent)
                        goto err_out_remove;
-               dirent->owner = THIS_MODULE;
                e->dirent = dirent;
        }
        ret = 0;
index b7c7d46511365ef5ff8c7bc93678a2ef97966c18..95d7f32643aef3a3e0b3830200ea592bb1b54849 100644 (file)
@@ -1604,10 +1604,6 @@ static int __init bcm_module_init(void)
 
        /* create /proc/net/can-bcm directory */
        proc_dir = proc_mkdir("can-bcm", init_net.proc_net);
-
-       if (proc_dir)
-               proc_dir->owner = THIS_MODULE;
-
        return 0;
 }
 
index 520fef5e5398aa867a267ae32bbffbba557795c2..1463653dbe34e986eb5f6283b7823ef109cb0fa8 100644 (file)
@@ -473,8 +473,6 @@ void can_init_proc(void)
                return;
        }
 
-       can_dir->owner = THIS_MODULE;
-
        /* own procfs entries from the AF_CAN core */
        pde_version     = can_create_proc_readentry(CAN_PROC_VERSION, 0644,
                                        can_proc_read_version, NULL);
index 32d419f5ac983e2601cda6ce189476a87886c699..3779c1438c11c84613f5ba9b40619907c9a18a9d 100644 (file)
@@ -3806,7 +3806,6 @@ static int __init pg_init(void)
        pg_proc_dir = proc_mkdir(PG_PROC_DIR, init_net.proc_net);
        if (!pg_proc_dir)
                return -ENODEV;
-       pg_proc_dir->owner = THIS_MODULE;
 
        pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops);
        if (pe == NULL) {
index 88e80a312732a9ed18e7e1d511d79ac6f0f9d682..8ff1861649e87716d8ecf826c8682182a825a88b 100644 (file)
@@ -70,7 +70,6 @@ void __init irda_proc_register(void)
        proc_irda = proc_mkdir("irda", init_net.proc_net);
        if (proc_irda == NULL)
                return;
-       proc_irda->owner = THIS_MODULE;
 
        for (i = 0; i < ARRAY_SIZE(irda_dirs); i++)
                d = proc_create(irda_dirs[i].name, 0, proc_irda,
index b58bd7c6cdf8b5323df957c1bc113b8970aa9762..d208b3396d94e417546a143c4c7a1d09f9e95f3b 100644 (file)
@@ -236,7 +236,6 @@ int __init llc_proc_init(void)
        llc_proc_dir = proc_mkdir("llc", init_net.proc_net);
        if (!llc_proc_dir)
                goto out;
-       llc_proc_dir->owner = THIS_MODULE;
 
        p = proc_create("socket", S_IRUGO, llc_proc_dir, &llc_seq_socket_fops);
        if (!p)
index cb198af8887c97628a82a903b1c93623dcb992e8..8eb3e61cb7011d1032d5562c0f266281ddf00688 100644 (file)
@@ -106,12 +106,8 @@ static __init int sctp_proc_init(void)
                goto out_nomem;
 #ifdef CONFIG_PROC_FS
        if (!proc_net_sctp) {
-               struct proc_dir_entry *ent;
-               ent = proc_mkdir("sctp", init_net.proc_net);
-               if (ent) {
-                       ent->owner = THIS_MODULE;
-                       proc_net_sctp = ent;
-               } else
+               proc_net_sctp = proc_mkdir("sctp", init_net.proc_net);
+               if (!proc_net_sctp)
                        goto out_free_percpu;
        }
 
index 4735caad26edc4195f503befa997a432145c7528..20029a79a5debf4a645623843c110eecaf5017ad 100644 (file)
@@ -313,7 +313,6 @@ static int create_cache_proc_entries(struct cache_detail *cd)
        cd->proc_ent = proc_mkdir(cd->name, proc_net_rpc);
        if (cd->proc_ent == NULL)
                goto out_nomem;
-       cd->proc_ent->owner = cd->owner;
        cd->channel_ent = cd->content_ent = NULL;
 
        p = proc_create_data("flush", S_IFREG|S_IRUSR|S_IWUSR,
@@ -321,7 +320,6 @@ static int create_cache_proc_entries(struct cache_detail *cd)
        cd->flush_ent = p;
        if (p == NULL)
                goto out_nomem;
-       p->owner = cd->owner;
 
        if (cd->cache_request || cd->cache_parse) {
                p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR,
@@ -329,7 +327,6 @@ static int create_cache_proc_entries(struct cache_detail *cd)
                cd->channel_ent = p;
                if (p == NULL)
                        goto out_nomem;
-               p->owner = cd->owner;
        }
        if (cd->cache_show) {
                p = proc_create_data("content", S_IFREG|S_IRUSR|S_IWUSR,
@@ -337,7 +334,6 @@ static int create_cache_proc_entries(struct cache_detail *cd)
                cd->content_ent = p;
                if (p == NULL)
                        goto out_nomem;
-               p->owner = cd->owner;
        }
        return 0;
 out_nomem:
index 085372ef4feb148bf99d0525074ef7c819c09051..1ef6e46d9da273b276625e765e6d6bd1c880457a 100644 (file)
@@ -262,14 +262,8 @@ void
 rpc_proc_init(void)
 {
        dprintk("RPC:       registering /proc/net/rpc\n");
-       if (!proc_net_rpc) {
-               struct proc_dir_entry *ent;
-               ent = proc_mkdir("rpc", init_net.proc_net);
-               if (ent) {
-                       ent->owner = THIS_MODULE;
-                       proc_net_rpc = ent;
-               }
-       }
+       if (!proc_net_rpc)
+               proc_net_rpc = proc_mkdir("rpc", init_net.proc_net);
 }
 
 void
index 70fa87189f3624694dc52ab3f04f48f13dba6fee..35df614f6c5599329a403beb7295f3ffe3a51d2e 100644 (file)
@@ -154,11 +154,6 @@ EXPORT_SYMBOL(snd_seq_root);
 struct snd_info_entry *snd_oss_root;
 #endif
 
-static inline void snd_info_entry_prepare(struct proc_dir_entry *de)
-{
-       de->owner = THIS_MODULE;
-}
-
 static void snd_remove_proc_entry(struct proc_dir_entry *parent,
                                  struct proc_dir_entry *de)
 {
@@ -522,32 +517,11 @@ static const struct file_operations snd_info_entry_operations =
        .release =              snd_info_entry_release,
 };
 
-/**
- * snd_create_proc_entry - create a procfs entry
- * @name: the name of the proc file
- * @mode: the file permission bits, S_Ixxx
- * @parent: the parent proc-directory entry
- *
- * Creates a new proc file entry with the given name and permission
- * on the given directory.
- *
- * Returns the pointer of new instance or NULL on failure.
- */
-static struct proc_dir_entry *snd_create_proc_entry(const char *name, mode_t mode,
-                                                   struct proc_dir_entry *parent)
-{
-       struct proc_dir_entry *p;
-       p = create_proc_entry(name, mode, parent);
-       if (p)
-               snd_info_entry_prepare(p);
-       return p;
-}
-
 int __init snd_info_init(void)
 {
        struct proc_dir_entry *p;
 
-       p = snd_create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL);
+       p = create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL);
        if (p == NULL)
                return -ENOMEM;
        snd_proc_root = p;
@@ -974,12 +948,11 @@ int snd_info_register(struct snd_info_entry * entry)
                return -ENXIO;
        root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
        mutex_lock(&info_mutex);
-       p = snd_create_proc_entry(entry->name, entry->mode, root);
+       p = create_proc_entry(entry->name, entry->mode, root);
        if (!p) {
                mutex_unlock(&info_mutex);
                return -ENOMEM;
        }
-       p->owner = entry->module;
        if (!S_ISDIR(entry->mode))
                p->proc_fops = &snd_info_entry_operations;
        p->size = entry->size;