aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha
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 /arch/alpha
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 'arch/alpha')
-rw-r--r--arch/alpha/kernel/srm_env.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c
index 78ad7cd1bbd6..d12af472e1c0 100644
--- a/arch/alpha/kernel/srm_env.c
+++ b/arch/alpha/kernel/srm_env.c
@@ -218,7 +218,6 @@ srm_env_init(void)
218 BASE_DIR); 218 BASE_DIR);
219 goto cleanup; 219 goto cleanup;
220 } 220 }
221 base_dir->owner = THIS_MODULE;
222 221
223 /* 222 /*
224 * Create per-name subdirectory 223 * Create per-name subdirectory
@@ -229,7 +228,6 @@ srm_env_init(void)
229 BASE_DIR, NAMED_DIR); 228 BASE_DIR, NAMED_DIR);
230 goto cleanup; 229 goto cleanup;
231 } 230 }
232 named_dir->owner = THIS_MODULE;
233 231
234 /* 232 /*
235 * Create per-number subdirectory 233 * Create per-number subdirectory
@@ -241,7 +239,6 @@ srm_env_init(void)
241 goto cleanup; 239 goto cleanup;
242 240
243 } 241 }
244 numbered_dir->owner = THIS_MODULE;
245 242
246 /* 243 /*
247 * Create all named nodes 244 * Create all named nodes
@@ -254,7 +251,6 @@ srm_env_init(void)
254 goto cleanup; 251 goto cleanup;
255 252
256 entry->proc_entry->data = (void *) entry; 253 entry->proc_entry->data = (void *) entry;
257 entry->proc_entry->owner = THIS_MODULE;
258 entry->proc_entry->read_proc = srm_env_read; 254 entry->proc_entry->read_proc = srm_env_read;
259 entry->proc_entry->write_proc = srm_env_write; 255 entry->proc_entry->write_proc = srm_env_write;
260 256
@@ -275,7 +271,6 @@ srm_env_init(void)
275 271
276 entry->id = var_num; 272 entry->id = var_num;
277 entry->proc_entry->data = (void *) entry; 273 entry->proc_entry->data = (void *) entry;
278 entry->proc_entry->owner = THIS_MODULE;
279 entry->proc_entry->read_proc = srm_env_read; 274 entry->proc_entry->read_proc = srm_env_read;
280 entry->proc_entry->write_proc = srm_env_write; 275 entry->proc_entry->write_proc = srm_env_write;
281 } 276 }