* [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting
@ 2026-08-04 12:19 Jinhui Guo
2026-08-04 12:19 ` [PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs Jinhui Guo
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jinhui Guo @ 2026-08-04 12:19 UTC (permalink / raw)
To: Thierry Reding, Jonathan Hunter, linux-tegra
Cc: linux-kernel, Kartik Rajput, Jinhui Guo
Hi,
This series contains two small fixes for the Tegra fuse driver.
Patch 1 fixes the legacy initialization path used on 32-bit ARM systems
when no FUSE device tree node is present. If the detected chip ID is not
supported, the current code only emits a warning and then continues with
fuse->soc left as NULL. This can lead to a NULL pointer dereference when
fuse->soc->init(fuse) is called later. Return -ENODEV from the default
case to stop initialization immediately.
Patch 2 adds a missing trailing newline to an APBMISC error message in
tegra_acpi_init_apbmisc(), so the kernel log remains properly formatted.
Jinhui Guo (2):
soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs
soc/tegra: fuse: Add missing newline to APBMISC error message
drivers/soc/tegra/fuse/fuse-tegra.c | 2 +-
drivers/soc/tegra/fuse/tegra-apbmisc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs
2026-08-04 12:19 [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting Jinhui Guo
@ 2026-08-04 12:19 ` Jinhui Guo
2026-08-05 7:40 ` Thierry Reding
2026-08-04 12:19 ` [PATCH 2/2] soc/tegra: fuse: Add missing newline to APBMISC error message Jinhui Guo
2026-08-05 7:47 ` (subset) [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting Thierry Reding
2 siblings, 1 reply; 5+ messages in thread
From: Jinhui Guo @ 2026-08-04 12:19 UTC (permalink / raw)
To: Thierry Reding, Jonathan Hunter, linux-tegra
Cc: linux-kernel, Kartik Rajput, Jinhui Guo
When booting without a FUSE device tree node, tegra_init_fuse() falls
back to legacy SoC detection on 32-bit ARM systems. If the detected chip
ID does not match any supported SoC, the default case only prints a
warning and breaks out of the switch statement.
In that case fuse->soc remains NULL, but initialization continues and
later calls fuse->soc->init(fuse), which results in a NULL pointer
dereference.
Return -ENODEV from the default case to stop initialization immediately
when the legacy fallback detects an unsupported SoC.
Fixes: 7e939de1b2bb ("soc/tegra: fuse: Unify Tegra20 and Tegra30 drivers")
Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
---
drivers/soc/tegra/fuse/fuse-tegra.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 78b054d43a42..e539e6b595b0 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -520,7 +520,7 @@ static int __init tegra_init_fuse(void)
default:
pr_warn("Unsupported SoC: %02x\n", chip);
- break;
+ return -ENODEV;
}
} else {
/*
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs
2026-08-04 12:19 ` [PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs Jinhui Guo
@ 2026-08-05 7:40 ` Thierry Reding
0 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2026-08-05 7:40 UTC (permalink / raw)
To: Jinhui Guo; +Cc: Jonathan Hunter, linux-tegra, linux-kernel, Kartik Rajput
[-- Attachment #1: Type: text/plain, Size: 1776 bytes --]
On Tue, Aug 04, 2026 at 08:19:09PM +0800, Jinhui Guo wrote:
> When booting without a FUSE device tree node, tegra_init_fuse() falls
> back to legacy SoC detection on 32-bit ARM systems. If the detected chip
> ID does not match any supported SoC, the default case only prints a
> warning and breaks out of the switch statement.
>
> In that case fuse->soc remains NULL, but initialization continues and
> later calls fuse->soc->init(fuse), which results in a NULL pointer
> dereference.
>
> Return -ENODEV from the default case to stop initialization immediately
> when the legacy fallback detects an unsupported SoC.
>
> Fixes: 7e939de1b2bb ("soc/tegra: fuse: Unify Tegra20 and Tegra30 drivers")
> Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
> ---
> drivers/soc/tegra/fuse/fuse-tegra.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
The likelihood of this happening is pretty much zero. The only way that
you could potentially trigger it is by intentionally booting the system
with an entirely wrong DTB. Like if you booted a Tegra DTB on an Exynos
system or something. In that case it's likely that things will go side-
ways much earlier than this and you kind of deserve the crash from the
fuse->soc being NULL.
As such this is kind of a feature that prevents the boot from continuing
even though it doesn't stand a chance.
Then again, I suspect some AI or static analyzer flagged that we might
run into a NULL dereference, so if I don't take this, someone else is
just going to send a similar patch at some point.
Maybe a good compromise would be to turn the pr_warn() into a BUG() to
keep the system from booting and make it obvious to analyzers that we're
not intending to proceed in this case.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] soc/tegra: fuse: Add missing newline to APBMISC error message
2026-08-04 12:19 [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting Jinhui Guo
2026-08-04 12:19 ` [PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs Jinhui Guo
@ 2026-08-04 12:19 ` Jinhui Guo
2026-08-05 7:47 ` (subset) [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting Thierry Reding
2 siblings, 0 replies; 5+ messages in thread
From: Jinhui Guo @ 2026-08-04 12:19 UTC (permalink / raw)
To: Thierry Reding, Jonathan Hunter, linux-tegra
Cc: linux-kernel, Kartik Rajput, Jinhui Guo
The error message printed by tegra_acpi_init_apbmisc() when failing to
get APBMISC memory resources is missing a trailing newline. This can
cause the message to be merged with the following kernel log line, making
the log harder to read.
Add the missing newline to keep the error output properly formatted.
Fixes: 7b0c505eb341 ("soc/tegra: fuse: Add tegra_acpi_init_apbmisc()")
Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
---
drivers/soc/tegra/fuse/tegra-apbmisc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
index 6af69ccaa295..f86c88fab168 100644
--- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
+++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
@@ -309,7 +309,7 @@ void tegra_acpi_init_apbmisc(void)
ret = acpi_dev_get_memory_resources(adev, &resource_list);
if (ret < 0) {
- pr_err("failed to get APBMISC memory resources");
+ pr_err("failed to get APBMISC memory resources\n");
goto out_put_acpi_dev;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: (subset) [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting
2026-08-04 12:19 [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting Jinhui Guo
2026-08-04 12:19 ` [PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs Jinhui Guo
2026-08-04 12:19 ` [PATCH 2/2] soc/tegra: fuse: Add missing newline to APBMISC error message Jinhui Guo
@ 2026-08-05 7:47 ` Thierry Reding
2 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2026-08-05 7:47 UTC (permalink / raw)
To: Thierry Reding, Jonathan Hunter, linux-tegra, Jinhui Guo
Cc: linux-kernel, Kartik Rajput
From: Thierry Reding <treding@nvidia.com>
On Tue, 04 Aug 2026 20:19:08 +0800, Jinhui Guo wrote:
> This series contains two small fixes for the Tegra fuse driver.
>
> Patch 1 fixes the legacy initialization path used on 32-bit ARM systems
> when no FUSE device tree node is present. If the detected chip ID is not
> supported, the current code only emits a warning and then continues with
> fuse->soc left as NULL. This can lead to a NULL pointer dereference when
> fuse->soc->init(fuse) is called later. Return -ENODEV from the default
> case to stop initialization immediately.
>
> [...]
Applied, thanks!
[2/2] soc/tegra: fuse: Add missing newline to APBMISC error message
commit: 308be3ea5c8d0bb362fb50c38923849a268e078e
Best regards,
--
Thierry Reding <treding@nvidia.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-05 7:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04 12:19 [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting Jinhui Guo
2026-08-04 12:19 ` [PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs Jinhui Guo
2026-08-05 7:40 ` Thierry Reding
2026-08-04 12:19 ` [PATCH 2/2] soc/tegra: fuse: Add missing newline to APBMISC error message Jinhui Guo
2026-08-05 7:47 ` (subset) [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox