From: Mark Rutland <mark.rutland@arm.com>
To: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: krzk@kernel.org, s.nawrocki@samsung.com, cw00.choi@samsung.com,
alim.akhtar@samsung.com, mturquette@baylibre.com,
sboyd@kernel.org, sunyeal.hong@samsung.com,
linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: samsung: Fix out-of-bound access of of_match_node()
Date: Mon, 30 Sep 2024 11:29:45 +0100 [thread overview]
Message-ID: <Zvp9mWLKveSz5Xdo@J2N7QTR9R3> (raw)
In-Reply-To: <20240927102104.3268790-1-ruanjinjie@huawei.com>
On Fri, Sep 27, 2024 at 06:21:04PM +0800, Jinjie Ruan wrote:
> Currently, there is no terminator entry for exynosautov920_cmu_of_match,
> hence facing below KASAN warning,
>
> ==================================================================
> BUG: KASAN: global-out-of-bounds in of_match_node+0x120/0x13c
> Read of size 1 at addr ffffffe31cc9e628 by task swapper/0/1
> The buggy address belongs to the variable:
> exynosautov920_cmu_of_match+0xc8/0x2c80
> Add a dummy terminator entry at the end to assist
> of_match_node() in traversing up to the terminator entry
> without accessing an out-of-boundary index.
>
> Fixes: 485e13fe2fb6 ("clk: samsung: add top clock support for ExynosAuto v920 SoC")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
FWIW, I'm hitting this while testing on v6.12-rc1, and my local fix was
essentially the same (adding a '{ /* sentintel */ }' entry), so FWIW,
with one minor nit below:
Acked-by: Mark Rutland <mark.rutland@arm.com>
> ---
> drivers/clk/samsung/clk-exynosautov920.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/clk/samsung/clk-exynosautov920.c b/drivers/clk/samsung/clk-exynosautov920.c
> index 7ba9748c0526..a3634003b29b 100644
> --- a/drivers/clk/samsung/clk-exynosautov920.c
> +++ b/drivers/clk/samsung/clk-exynosautov920.c
> @@ -1155,6 +1155,7 @@ static const struct of_device_id exynosautov920_cmu_of_match[] = {
> .compatible = "samsung,exynosautov920-cmu-peric0",
> .data = &peric0_cmu_info,
> },
> + { },
Nit: the sentinal entry is meant to be the last entry, so it shouldn't
have a trailing comma.
Regardless of that, it'd be nice to have this fix in -rc2, since anyone
trying to test with KASAN is going to hit this at boot time.
Mark.
> };
>
> static struct platform_driver exynosautov920_cmu_driver __refdata = {
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-09-30 10:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 10:21 Jinjie Ruan
2024-09-30 10:29 ` Mark Rutland [this message]
2024-09-30 10:33 ` Krzysztof Kozlowski
2024-09-30 10:35 ` Krzysztof Kozlowski
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=Zvp9mWLKveSz5Xdo@J2N7QTR9R3 \
--to=mark.rutland@arm.com \
--cc=alim.akhtar@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=ruanjinjie@huawei.com \
--cc=s.nawrocki@samsung.com \
--cc=sboyd@kernel.org \
--cc=sunyeal.hong@samsung.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
all inboxes | Powered by JetHome®