From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Aleksandr Mishin <amishin@t-argos.ru>,
Weiyi Lu <weiyi.lu@mediatek.com>,
stable@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Sasha Levin <sashal@kernel.org>,
Markus Schneider-Pargmann <msp@baylibre.com>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, lvc-project@linuxtesting.org
Subject: Re: [PATCH 5.10/5.15/6.1] clk: mediatek: Add memory allocation fail handling in clk_mt2712_top_init_early()
Date: Thu, 6 Jun 2024 13:17:53 +0200 [thread overview]
Message-ID: <53ca5125-53d7-446a-aeb4-a506549be1f4@collabora.com> (raw)
In-Reply-To: <20240606110955.35313-1-amishin@t-argos.ru>
Il 06/06/24 13:09, Aleksandr Mishin ha scritto:
> No upstream commit exists for this commit.
>
> The issue was introduced with commit e2f744a82d72 ("clk: mediatek:
> Add MT2712 clock support")
>
> In case of memory allocation fail in clk_mt2712_top_init_early()
> 'top_clk_data' will be set to NULL and later dereferenced without check.
> Fix this bug by adding NULL-return check.
>
> Upstream branch code has been significantly refactored and can't be
> backported directly.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
...the fixes tag is still missing.
Regards,
Angelo
> Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
> ---
> drivers/clk/mediatek/clk-mt2712.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c
> index a0f0c9ed48d1..1830bae661dc 100644
> --- a/drivers/clk/mediatek/clk-mt2712.c
> +++ b/drivers/clk/mediatek/clk-mt2712.c
> @@ -1277,6 +1277,11 @@ static void clk_mt2712_top_init_early(struct device_node *node)
>
> if (!top_clk_data) {
> top_clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
> + if (!top_clk_data) {
> + pr_err("%s(): could not register clock provider: %d\n",
> + __func__, -ENOMEM);
> + return;
> + }
>
> for (i = 0; i < CLK_TOP_NR_CLK; i++)
> top_clk_data->hws[i] = ERR_PTR(-EPROBE_DEFER);
next prev parent reply other threads:[~2024-06-06 11:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 11:09 Aleksandr Mishin
2024-06-06 11:17 ` AngeloGioacchino Del Regno [this message]
2024-06-06 11:26 ` [PATCH 5.10/5.15/6.1 v2] " Aleksandr Mishin
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=53ca5125-53d7-446a-aeb4-a506549be1f4@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=amishin@t-argos.ru \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lvc-project@linuxtesting.org \
--cc=matthias.bgg@gmail.com \
--cc=msp@baylibre.com \
--cc=mturquette@baylibre.com \
--cc=sashal@kernel.org \
--cc=sboyd@kernel.org \
--cc=stable@vger.kernel.org \
--cc=weiyi.lu@mediatek.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®