diff options
author | Denis V. Lunev <den@openvz.org> | 2008-04-29 04:02:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:06:21 -0400 |
commit | 659f865ea65a60564ce00a0c571099d1fa55e8e3 (patch) | |
tree | a585a6e0f715cf37a6c80ec3a08db3104194cd7c /drivers/zorro/proc.c | |
parent | 7bf4e6d3e948e38893c718fa9c5bd0dfbfa49670 (diff) |
zorro: use non-racy method for proc entries creation
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>
Diffstat (limited to 'drivers/zorro/proc.c')
-rw-r--r-- | drivers/zorro/proc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index 1b4317d7d7aa..099b6fb5b5cb 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c | |||
@@ -77,6 +77,7 @@ proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t * | |||
77 | } | 77 | } |
78 | 78 | ||
79 | static const struct file_operations proc_bus_zorro_operations = { | 79 | static const struct file_operations proc_bus_zorro_operations = { |
80 | .owner = THIS_MODULE, | ||
80 | .llseek = proc_bus_zorro_lseek, | 81 | .llseek = proc_bus_zorro_lseek, |
81 | .read = proc_bus_zorro_read, | 82 | .read = proc_bus_zorro_read, |
82 | }; | 83 | }; |
@@ -136,11 +137,11 @@ static int __init zorro_proc_attach_device(u_int slot) | |||
136 | char name[4]; | 137 | char name[4]; |
137 | 138 | ||
138 | sprintf(name, "%02x", slot); | 139 | sprintf(name, "%02x", slot); |
139 | entry = create_proc_entry(name, 0, proc_bus_zorro_dir); | 140 | entry = proc_create_data(name, 0, proc_bus_zorro_dir, |
141 | &proc_bus_zorro_operations, | ||
142 | &zorro_autocon[slot]); | ||
140 | if (!entry) | 143 | if (!entry) |
141 | return -ENOMEM; | 144 | return -ENOMEM; |
142 | entry->proc_fops = &proc_bus_zorro_operations; | ||
143 | entry->data = &zorro_autocon[slot]; | ||
144 | entry->size = sizeof(struct zorro_dev); | 145 | entry->size = sizeof(struct zorro_dev); |
145 | return 0; | 146 | return 0; |
146 | } | 147 | } |