From: Jon Hunter <jonathanh@nvidia.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
Sumit Gupta <sumitg@nvidia.com>,
treding@nvidia.com, linux-kernel@vger.kernel.org,
linux-tegra@vger.kernel.org
Cc: bbasu@nvidia.com
Subject: Re: [PATCH 1/3] memory: tegra186-emc: stop borrowing MC aggregate hook for EMC
Date: Tue, 9 Jun 2026 16:07:13 +0100 [thread overview]
Message-ID: <0d8f1f3b-ed7b-4066-af6e-08c006788535@nvidia.com> (raw)
In-Reply-To: <31cba498-24c9-4d73-bb17-bba9cf730b55@kernel.org>
On 09/06/2026 16:01, Krzysztof Kozlowski wrote:
> On 27/05/2026 16:01, Sumit Gupta wrote:
>> tegra186_emc_interconnect_init() copies the MC's ICC aggregate hook
>> into the EMC provider. That hook (tegra234_mc_icc_aggregate /
>> tegra264_mc_icc_aggregate) uses container_of() to recover 'mc',
>> which is only valid when the icc_provider is embedded in struct
>> tegra_mc. For an EMC node the provider is embedded in struct
>> tegra186_emc, so 'mc' points into unrelated memory.
>>
>> This stayed harmless until commit faafd6ca7e6e ("memory: tegra:
>> make icc_set_bw return zero if BWMGR not supported") added an
>> unconditional read of mc->bwmgr_mrq_supported at the top of the
>> hook. UBSAN catches the stray load on every EMC aggregation:
>>
>> UBSAN: invalid-load in drivers/memory/tegra/tegra234.c:1104:9
>> load of value 112 is not a valid value for type '_Bool'
>>
>> No functional impact in practice, since the hook's only other mc
>> dereference (mc->num_channels) sits inside a
>> TEGRA_ICC_MC_CPU_CLUSTER* branch that EMC nodes never enter.
>>
>> Fix this by setting the EMC provider's aggregate hook to
>> icc_std_aggregate, instead of borrowing the MC's hook. The MC
>> providers continue using their own aggregate hooks, where
>> container_of() correctly resolves to struct tegra_mc.
>>
>> Reported-by: Jon Hunter <jonathanh@nvidia.com>
>
> I assume these reports were offlist. Otherwise this has a valid
> checkpatch warning.
Yes some of our internal testing flagged this and I had asked Sumit to
take a look.
Cheers
Jon
--
nvpublic
next prev parent reply other threads:[~2026-06-09 15:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 14:01 [PATCH 0/3] memory: tegra: UBSAN fix and cleanups Sumit Gupta
2026-05-27 14:01 ` [PATCH 1/3] memory: tegra186-emc: stop borrowing MC aggregate hook for EMC Sumit Gupta
2026-06-09 15:01 ` Krzysztof Kozlowski
2026-06-09 15:07 ` Jon Hunter [this message]
2026-06-09 15:08 ` Krzysztof Kozlowski
2026-05-27 14:01 ` [PATCH 2/3] memory: tegra264: drop redundant tegra264_mc_icc_aggregate() Sumit Gupta
2026-05-27 14:01 ` [PATCH 3/3] memory: tegra234: drop dead NULL check in tegra234_mc_icc_aggregate() Sumit Gupta
2026-06-09 14:51 ` [PATCH 0/3] memory: tegra: UBSAN fix and cleanups Jon Hunter
2026-06-09 15:02 ` 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=0d8f1f3b-ed7b-4066-af6e-08c006788535@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=bbasu@nvidia.com \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=sumitg@nvidia.com \
--cc=treding@nvidia.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®