From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Linus Walleij <linusw@kernel.org>,
Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
Rosen Penev <rosenp@gmail.com>,
Dmitry Osipenko <digetx@gmail.com>,
Sowjanya Komatineni <skomatineni@nvidia.com>,
linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 05/12] pinctrl: tegra: Require at least one register bank in tegra_pinctrl_probe()
Date: Wed, 2 Dec 2026 09:29:59 +0000 [thread overview]
Message-ID: <925fe53121a55db9d17afa509c97886ef5f7e93b.1796203691.git.lee@kernel.org> (raw)
In-Reply-To: <cover.1796203691.git.lee@kernel.org>
tegra_pinctrl_probe() counts IORESOURCE_MEM resources without checking
that at least one memory bank is present. If a device tree node omits
the reg property, pmx->nbanks is 0, pmx->regs is allocated as
ZERO_SIZE_PTR, and tegra_pinctrl_resume() unconditionally dereferences
pmx->regs[0] to flush writes.
Return -ENODEV from tegra_pinctrl_probe() if pmx->nbanks is 0.
Fixes: a4873accca05 ("pinctrl: tegra: Flush pinctrl writes during resume")
Closes: https://sashiko.dev/#/bug/linux-dc81d6b3-2c40-4253-b0f9-393c796e6adb
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/pinctrl/tegra/pinctrl-tegra.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c
index 51684c5dda34..62a19c6eda3a 100644
--- a/drivers/pinctrl/tegra/pinctrl-tegra.c
+++ b/drivers/pinctrl/tegra/pinctrl-tegra.c
@@ -903,6 +903,8 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
backup_regs_size += resource_size(res);
}
pmx->nbanks = i;
+ if (!pmx->nbanks)
+ return -ENODEV;
pmx->regs = devm_kzalloc_objs(&pdev->dev, *pmx->regs, pmx->nbanks);
if (!pmx->regs)
--
2.56.1.911.g883d8bcb20-goog
next prev parent reply other threads:[~2026-12-02 9:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 9:29 [PATCH 00/12] pinctrl: Fix Critical and High issues reported by Sashiko (batch 3) Lee Jones
2026-12-02 9:29 ` [PATCH 01/12] pinctrl: stm32: Validate npins against STM32_GPIO_PINS_PER_BANK Lee Jones
2026-12-02 9:29 ` [PATCH 02/12] pinctrl: imx: Validate pin_id in imx_pinctrl_parse_pin_mmio() Lee Jones
2026-12-02 9:29 ` [PATCH 03/12] pinctrl: single: Protect group and function updates with pctldev->mutex Lee Jones
2026-12-02 14:08 ` Bartosz Golaszewski
2026-12-02 9:29 ` [PATCH 04/12] pinctrl: imx: Propagate DT parsing errors in imx_pinctrl_probe_dt() Lee Jones
2026-12-02 9:29 ` Lee Jones [this message]
2026-12-02 9:30 ` [PATCH 06/12] pinctrl: imx: Serialise MMIO register updates with a spinlock Lee Jones
2026-12-02 9:30 ` [PATCH 07/12] pinctrl: nuvoton: ma35: Avoid double free of shared pin configs Lee Jones
2026-12-02 9:30 ` [PATCH 08/12] pinctrl: keembay: Check src before calling keembay_find_free_slot() Lee Jones
2026-12-02 9:30 ` [PATCH 09/12] pinctrl: ti: iodelay: Protect generic group addition with pctldev->mutex Lee Jones
2026-12-02 9:30 ` [PATCH 10/12] pinctrl: sunxi: Serialise per-bank regulator request and free Lee Jones
2026-12-02 9:30 ` [PATCH 11/12] pinctrl: stm32: Protect irqmux restore with hwspinlock during resume Lee Jones
2026-12-02 9:30 ` [PATCH 12/12] pinctrl: sx150x: Register threaded IRQ after adding GPIO chip Lee Jones
2026-12-02 9:35 ` Neil Armstrong
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=925fe53121a55db9d17afa509c97886ef5f7e93b.1796203691.git.lee@kernel.org \
--to=lee@kernel.org \
--cc=digetx@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=rosenp@gmail.com \
--cc=skomatineni@nvidia.com \
--cc=stable@vger.kernel.org \
--cc=thierry.reding@kernel.org \
/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®