From: Sergey Shtylyov <sergei.shtylyov@gmail.com>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MIPS: validate DT bootargs before appending them
Date: Fri, 3 Apr 2026 10:58:32 +0300 [thread overview]
Message-ID: <591cb5e6-26aa-4ed0-9298-5fc4c9742071@gmail.com> (raw)
In-Reply-To: <20260403161001.1-mips-dt-bootargs-pengpeng@iscas.ac.cn>
On 4/3/26 8:41 AM, Pengpeng Hou wrote:
> bootcmdline_scan_chosen() fetches the raw flat-DT bootargs property and
> passes it straight to bootcmdline_append(). That helper later feeds the
> same pointer into strlcat(), which computes strlen(src) before copying.
> Flat DT properties are external boot input, and this path does not
> prove that bootargs is NUL-terminated within its declared bounds.
>
> Reject unterminated bootargs properties before appending them to the
> kernel command line.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> arch/mips/kernel/setup.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> index f9b228e33f3b..dd7915110820 100644
> --- a/arch/mips/kernel/setup.c
> +++ b/arch/mips/kernel/setup.c
[...]
> @@ -541,6 +542,9 @@ static int __init bootcmdline_scan_chosen(unsigned long node, const char *uname,
>
> p = of_get_flat_dt_prop(node, "bootargs", &l);
> if (p != NULL && l > 0) {
> + if (!memchr(p, '\0', l))
Maybe strnlen()?
[...]
MBR, Sergey
next prev parent reply other threads:[~2026-04-03 7:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 5:41 [PATCH] MIPS: validate DT bootargs before appending them Pengpeng Hou
2026-04-03 7:58 ` Sergey Shtylyov [this message]
2026-04-07 1:57 ` [PATCH v2] " Pengpeng Hou
2026-04-13 13:43 ` Thomas Bogendoerfer
2026-04-07 3:30 ` [PATCH] " Pengpeng Hou
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=591cb5e6-26aa-4ed0-9298-5fc4c9742071@gmail.com \
--to=sergei.shtylyov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=pengpeng@iscas.ac.cn \
--cc=tsbogend@alpha.franken.de \
/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