]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
zorro: use non-racy method for proc entries creation
authorDenis V. Lunev <den@openvz.org>
Tue, 29 Apr 2008 08:02:16 +0000 (01:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Apr 2008 15:06:21 +0000 (08:06 -0700)
Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data
be setup before gluing PDE to main tree.

Add correct ->owner to proc_fops to fix reading/module unloading race.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/zorro/proc.c

index 1b4317d7d7aad60f1ba3cf836803c076203c9e6e..099b6fb5b5cbd364817776edf8cc68129fe482df 100644 (file)
@@ -77,6 +77,7 @@ proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *
 }
 
 static const struct file_operations proc_bus_zorro_operations = {
+       .owner          = THIS_MODULE,
        .llseek         = proc_bus_zorro_lseek,
        .read           = proc_bus_zorro_read,
 };
@@ -136,11 +137,11 @@ static int __init zorro_proc_attach_device(u_int slot)
        char name[4];
 
        sprintf(name, "%02x", slot);
-       entry = create_proc_entry(name, 0, proc_bus_zorro_dir);
+       entry = proc_create_data(name, 0, proc_bus_zorro_dir,
+                                &proc_bus_zorro_operations,
+                                &zorro_autocon[slot]);
        if (!entry)
                return -ENOMEM;
-       entry->proc_fops = &proc_bus_zorro_operations;
-       entry->data = &zorro_autocon[slot];
        entry->size = sizeof(struct zorro_dev);
        return 0;
 }