From: Dan Ehrenberg <dehrenberg@chromium.org>
To: viro@zeniv.linux.org.uk, snitzer@redhat.com, agk@redhat.com
Cc: grundler@chromium.org, gwendal@chromium.org, dm-devel@redhat.com,
linux-kernel@vger.kernel.org, ebiederm@xmission.com,
Dan Ehrenberg <dehrenberg@chromium.org>
Subject: [PATCH v2 2/3] init: Stricter checking of major:minor root= values
Date: Tue, 10 Feb 2015 15:20:50 -0800 [thread overview]
Message-ID: <1423610451-22600-2-git-send-email-dehrenberg@chromium.org> (raw)
In-Reply-To: <1423610451-22600-1-git-send-email-dehrenberg@chromium.org>
In the kernel command-line, previously, root=1:2jakshflaksjdhfa would
be accepted and interpreted just like root=1:2. This patch adds
stricter checking so that additional characters after major:minor are
rejected by root=.
The goal of this patch is to help in unifying dm's interpretation of
its block device argument with the interpretation in other parts of
the kernel. dm rejects malformed major:minor pairs, and it seems
reasonable that root= could reject them as well.
Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org>
---
init/do_mounts.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 4b2daf1..24f359f 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -226,8 +226,9 @@ dev_t name_to_dev_t(const char *name)
if (strncmp(name, "/dev/", 5) != 0) {
unsigned maj, min;
+ char dummy;
- if (sscanf(name, "%u:%u", &maj, &min) == 2) {
+ if (sscanf(name, "%u:%u%c", &maj, &min, &dummy) == 2) {
res = MKDEV(maj, min);
if (maj != MAJOR(res) || min != MINOR(res))
goto fail;
--
2.2.0.rc0.207.ga3a616c
next prev parent reply other threads:[~2015-02-10 23:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-10 23:20 [PATCH v2 1/3] init: Export name_to_dev_t and mark it const Dan Ehrenberg
2015-02-10 23:20 ` Dan Ehrenberg [this message]
2015-02-10 23:20 ` [PATCH v2 3/3] dm: Get devices using name_to_dev_t Dan Ehrenberg
2015-03-18 21:28 ` [PATCH v2 1/3] init: Export name_to_dev_t and mark it const Mike Snitzer
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=1423610451-22600-2-git-send-email-dehrenberg@chromium.org \
--to=dehrenberg@chromium.org \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=ebiederm@xmission.com \
--cc=grundler@chromium.org \
--cc=gwendal@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®