Commit 659f865ea65a60564ce00a0c571099d1fa55e8e3
Committed by
Linus Torvalds
1 parent
7bf4e6d3e9
Exists in
master
and in
4 other branches
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>
Showing 1 changed file with 4 additions and 3 deletions Side-by-side Diff
drivers/zorro/proc.c
... | ... | @@ -77,6 +77,7 @@ |
77 | 77 | } |
78 | 78 | |
79 | 79 | static const struct file_operations proc_bus_zorro_operations = { |
80 | + .owner = THIS_MODULE, | |
80 | 81 | .llseek = proc_bus_zorro_lseek, |
81 | 82 | .read = proc_bus_zorro_read, |
82 | 83 | }; |
83 | 84 | |
... | ... | @@ -136,11 +137,11 @@ |
136 | 137 | char name[4]; |
137 | 138 | |
138 | 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 | 143 | if (!entry) |
141 | 144 | return -ENOMEM; |
142 | - entry->proc_fops = &proc_bus_zorro_operations; | |
143 | - entry->data = &zorro_autocon[slot]; | |
144 | 145 | entry->size = sizeof(struct zorro_dev); |
145 | 146 | return 0; |
146 | 147 | } |