From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Thorsten Blum <blum@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Dan Moulding <dmoulding@me.com>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.6.y 2/2] init: fix early boot crash with bare hostname parameter
Date: Tue, 10 Nov 2026 09:34:47 -0500 [thread overview]
Message-ID: <20261110143440.1917716-2-sashal@kernel.org> (raw)
In-Reply-To: <20261110143440.1917716-1-sashal@kernel.org>
From: Thorsten Blum <blum@kernel.org>
[ Upstream commit b6bec5b63a5b812145e53aaad1e63661c7214f93 ]
When a bare hostname parameter is specified on the kernel command line
without the '=' separator, early parameter parsing passes NULL to
early_hostname(), which dereferences it in strscpy() and can crash the
system during early boot.
Reject NULL values in early_hostname() and return -EINVAL instead.
Link: https://lore.kernel.org/20260826100904.296151-2-blum@kernel.org
Fixes: 5a704629f2c1 ("init: add "hostname" kernel parameter")
Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Moulding <dmoulding@me.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
init/version.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/init/version.c b/init/version.c
index 94c96f6fbfe6a..0bd5c45aabc46 100644
--- a/init/version.c
+++ b/init/version.c
@@ -23,6 +23,9 @@ static int __init early_hostname(char *arg)
size_t maxlen = bufsize - 1;
ssize_t arglen;
+ if (!arg)
+ return -EINVAL;
+
arglen = strscpy(init_uts_ns.name.nodename, arg, bufsize);
if (arglen < 0) {
pr_warn("hostname parameter exceeds %zd characters and will be truncated",
--
2.53.0
prev parent reply other threads:[~2026-11-10 14:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 10:32 FAILED: patch "[PATCH] init: fix early boot crash with bare hostname parameter" failed to apply to 6.6-stable tree Sasha Levin
2026-11-10 14:34 ` [PATCH 6.6.y 1/2] init/version.c: Replace strlcpy with strscpy Sasha Levin
2026-11-10 14:34 ` Sasha Levin [this message]
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=20261110143440.1917716-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=blum@kernel.org \
--cc=dmoulding@me.com \
--cc=stable@vger.kernel.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