Commit 25620d2c authored by Nathan Lynch's avatar Nathan Lynch Committed by Linus Torvalds

[PATCH] prohibit slash in proc directory entry names

proc_create() needs to check that the name of an entry to be created does
not contain a '/' character.

To test, I hacked the ibmveth driver to try to call request_irq with a
bogus "foo/bar" devname.  The creation of the /proc/irq/1234/xxx entry
silently fails, as intended.  Perhaps the irq code should be made to check
for the failure.
Signed-off-by: default avatarNathan Lynch <nathanl@austin.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 099ddb53
...@@ -551,6 +551,11 @@ static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, ...@@ -551,6 +551,11 @@ static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent,
if (!(*parent) && xlate_proc_name(name, parent, &fn) != 0) if (!(*parent) && xlate_proc_name(name, parent, &fn) != 0)
goto out; goto out;
/* At this point there must not be any '/' characters beyond *fn */
if (strchr(fn, '/'))
goto out;
len = strlen(fn); len = strlen(fn);
ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL); ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment