projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5de3d40
)
proc: reject "." and ".." as filenames
author
Alexey Dobriyan
<
[email protected]
>
Tue, 10 Apr 2018 23:32:11 +0000
(16:32 -0700)
committer
Linus Torvalds
<
[email protected]
>
Wed, 11 Apr 2018 17:28:34 +0000
(10:28 -0700)
Various subsystems can create files and directories in /proc with names
directly controlled by userspace.
Which means "/", "." and ".." are no-no.
"/" split is already taken care of, do the other 2 prohibited names.
Link:
http://lkml.kernel.org/r/20180310001223.GB12443@avx2
Signed-off-by: Alexey Dobriyan <
[email protected]
>
Acked-by: Florian Westphal <
[email protected]
>
Cc: Eric Dumazet <
[email protected]
>
Cc: Cong Wang <
[email protected]
>
Cc: Pavel Machek <
[email protected]
>
Cc: Al Viro <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
fs/proc/generic.c
patch
|
blob
|
history
diff --git
a/fs/proc/generic.c
b/fs/proc/generic.c
index 800247a256c9395b54fbb4f0d25b3fb72c6a3948..5dad2e89007bf841fee2426636e9bcb961b10ff2 100644
(file)
--- a/
fs/proc/generic.c
+++ b/
fs/proc/generic.c
@@
-366,6
+366,14
@@
static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
WARN(1, "name len %u\n", qstr.len);
return NULL;
}
+ if (qstr.len == 1 && fn[0] == '.') {
+ WARN(1, "name '.'\n");
+ return NULL;
+ }
+ if (qstr.len == 2 && fn[0] == '.' && fn[1] == '.') {
+ WARN(1, "name '..'\n");
+ return NULL;
+ }
if (*parent == &proc_root && name_to_int(&qstr) != ~0U) {
WARN(1, "create '/proc/%s' by hand\n", qstr.name);
return NULL;