From: Andrew Morton <akpm@linux-foundation.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-kernel@vger.kernel.org, eric.dumazet@gmail.com,
xiyou.wangcong@gmail.com, fw@strlen.de
Subject: Re: [PATCH] proc: reject "." and ".." as filenames
Date: Mon, 12 Mar 2018 16:00:18 -0700 [thread overview]
Message-ID: <20180312160018.5d4cb6917c84b2805ff32d1d@linux-foundation.org> (raw)
In-Reply-To: <20180310001223.GB12443@avx2>
On Sat, 10 Mar 2018 03:12:23 +0300 Alexey Dobriyan <adobriyan@gmail.com> wrote:
> 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.
>
> --- 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;
--- a/fs/proc/generic.c~proc-reject-and-as-filenames-fix
+++ a/fs/proc/generic.c
@@ -387,10 +387,8 @@ static struct proc_dir_entry *__proc_cre
WARN(1, "name len %u\n", qstr.len);
return NULL;
}
- if (qstr.len == 1 && fn[0] == '.') {
- WARN(1, "name '.'\n");
+ if (WARN(qstr.len == 1 && fn[0] == '.', "name '.'\n"))
return NULL;
- }
if (qstr.len == 2 && fn[0] == '.' && fn[1] == '.') {
WARN(1, "name '..'\n");
return NULL;
is neater, but the whole function should be thus converted and I'll let
you decide on that.
next prev parent reply other threads:[~2018-03-12 23:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-10 0:12 Alexey Dobriyan
2018-03-10 0:19 ` Florian Westphal
2018-03-11 21:30 ` Pavel Machek
2018-03-11 21:35 ` Alexey Dobriyan
2018-03-11 21:41 ` Pavel Machek
2018-03-12 23:00 ` Andrew Morton [this message]
2018-03-13 7:20 ` Alexey Dobriyan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180312160018.5d4cb6917c84b2805ff32d1d@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=adobriyan@gmail.com \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=linux-kernel@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome