aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/root.c
diff options
context:
space:
mode:
authorDenis V. Lunev <[email protected]>2008-04-29 08:02:00 +0000
committerLinus Torvalds <[email protected]>2008-04-29 15:06:20 +0000
commit59b7435149eab2dd06dd678742faff6049cb655f (patch)
treeceadbf157a001b83a3ab2c89156426e88a782208 /fs/proc/root.c
parentproc: convert /proc/tty/ldiscs to seq_file interface (diff)
downloadkernel-59b7435149eab2dd06dd678742faff6049cb655f.tar.gz
kernel-59b7435149eab2dd06dd678742faff6049cb655f.zip
proc: introduce proc_create_data to setup de->data
This set of patches fixes an proc ->open'less usage due to ->proc_fops flip in the most part of the kernel code. The original OOPS is described in the commit 2d3a4e3666325a9709cc8ea2e88151394e8f20fc: Typical PDE creation code looks like: pde = create_proc_entry("foo", 0, NULL); if (pde) pde->proc_fops = &foo_proc_fops; Notice that PDE is first created, only then ->proc_fops is set up to final value. This is a problem because right after creation a) PDE is fully visible in /proc , and b) ->proc_fops are proc_file_operations which do not have ->open callback. So, it's possible to ->read without ->open (see one class of oopses below). The fix is new API called proc_create() which makes sure ->proc_fops are set up before gluing PDE to main tree. Typical new code looks like: pde = proc_create("foo", 0, NULL, &foo_proc_fops); if (!pde) return -ENOMEM; Fix most networking users for a start. In the long run, create_proc_entry() for regular files will go. In addition to this, proc_create_data is introduced to fix reading from proc without PDE->data. The race is basically the same as above. create_proc_entries is replaced in the entire kernel code as new method is also simply better. This patch: The problem is the same as for de->proc_fops. Right now PDE becomes visible without data set. So, the entry could be looked up without data. This, in most cases, will simply OOPS. proc_create_data call is created to address this issue. proc_create now becomes a wrapper around it. Signed-off-by: Denis V. Lunev <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Cc: "J. Bruce Fields" <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Chris Mason <[email protected]> Acked-by: David Howells <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Grant Grundler <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Haavard Skinnemoen <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Bottomley <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Jeff Garzik <[email protected]> Cc: Jeff Mahoney <[email protected]> Cc: Jesper Nilsson <[email protected]> Cc: Karsten Keil <[email protected]> Cc: Kyle McMartin <[email protected]> Cc: Len Brown <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: Mikael Starvik <[email protected]> Cc: Nadia Derbey <[email protected]> Cc: Neil Brown <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Osterlund <[email protected]> Cc: Pierre Peiffer <[email protected]> Cc: Russell King <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: Tony Luck <[email protected]> Cc: Trond Myklebust <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'fs/proc/root.c')
-rw-r--r--fs/proc/root.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/proc/root.c b/fs/proc/root.c
index c741b45a5503..95117538a4f6 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -230,5 +230,5 @@ void pid_ns_release_proc(struct pid_namespace *ns)
EXPORT_SYMBOL(proc_symlink);
EXPORT_SYMBOL(proc_mkdir);
EXPORT_SYMBOL(create_proc_entry);
-EXPORT_SYMBOL(proc_create);
+EXPORT_SYMBOL(proc_create_data);
EXPORT_SYMBOL(remove_proc_entry);