From: Al Viro <viro@zeniv.linux.org.uk>
To: Siddhesh Poyarekar <siddhesh@gotplt.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Florian Weimer <fweimer@redhat.com>
Subject: Re: [PATCH v2] proc: Escape more characters in /proc/mounts output
Date: Wed, 16 Dec 2020 04:33:23 +0000 [thread overview]
Message-ID: <20201216043323.GM3579531@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20201215125318.2681355-1-siddhesh@gotplt.org>
On Tue, Dec 15, 2020 at 06:23:18PM +0530, Siddhesh Poyarekar wrote:
> +static char *copy_mount_devname(const void __user *data)
> +{
> + char *p;
> + long length;
> +
> + if (data == NULL)
> + return NULL;
> +
> + length = strnlen_user(data, PATH_MAX);
> +
> + if (!length)
> + return ERR_PTR(-EFAULT);
> +
> + if (length > PATH_MAX)
> + return ERR_PTR(-EINVAL);
> +
> + /* Ignore blank strings */
> + if (length == 1)
> + return NULL;
> +
> + p = memdup_user(data, length);
Once more, with feeling: why bother? What's wrong
with using the damn strndup_user() and then doing
whatever checks you want with the data already
copied, living in normal kernel memory, with all
string functions applicable, etc.?
next prev parent reply other threads:[~2020-12-16 4:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-15 12:53 [PATCH v2] proc: Escape more characters in /proc/mounts output Siddhesh Poyarekar
2020-12-16 4:33 ` Al Viro [this message]
2020-12-16 5:25 ` Siddhesh Poyarekar
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=20201216043323.GM3579531@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=fweimer@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=siddhesh@gotplt.org \
/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