aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/cache.c
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 /net/sunrpc/cache.c
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 'net/sunrpc/cache.c')
-rw-r--r--net/sunrpc/cache.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 4735caad26ed..20029a79a5de 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -313,7 +313,6 @@ static int create_cache_proc_entries(struct cache_detail *cd)
313 cd->proc_ent = proc_mkdir(cd->name, proc_net_rpc); 313 cd->proc_ent = proc_mkdir(cd->name, proc_net_rpc);
314 if (cd->proc_ent == NULL) 314 if (cd->proc_ent == NULL)
315 goto out_nomem; 315 goto out_nomem;
316 cd->proc_ent->owner = cd->owner;
317 cd->channel_ent = cd->content_ent = NULL; 316 cd->channel_ent = cd->content_ent = NULL;
318 317
319 p = proc_create_data("flush", S_IFREG|S_IRUSR|S_IWUSR, 318 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)
321 cd->flush_ent = p; 320 cd->flush_ent = p;
322 if (p == NULL) 321 if (p == NULL)
323 goto out_nomem; 322 goto out_nomem;
324 p->owner = cd->owner;
325 323
326 if (cd->cache_request || cd->cache_parse) { 324 if (cd->cache_request || cd->cache_parse) {
327 p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR, 325 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)
329 cd->channel_ent = p; 327 cd->channel_ent = p;
330 if (p == NULL) 328 if (p == NULL)
331 goto out_nomem; 329 goto out_nomem;
332 p->owner = cd->owner;
333 } 330 }
334 if (cd->cache_show) { 331 if (cd->cache_show) {
335 p = proc_create_data("content", S_IFREG|S_IRUSR|S_IWUSR, 332 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)
337 cd->content_ent = p; 334 cd->content_ent = p;
338 if (p == NULL) 335 if (p == NULL)
339 goto out_nomem; 336 goto out_nomem;
340 p->owner = cd->owner;
341 } 337 }
342 return 0; 338 return 0;
343out_nomem: 339out_nomem: