[PATCH] pinctrl: at91: Fix potential use-after-free on manual unbind

From: Guangshuo Li

Date: Fri Nov 20 2026 - 12:36:24 EST


The built-in GPIO and pinctrl drivers share GPIO ranges and global bank
pointers but provide no teardown for those relationships. Manually
unbinding a GPIO bank frees its private data while pinctrl still holds
its embedded range, which is accessed during pinctrl cleanup.

Suppress the bind attributes for these non-removable SoC controllers
so userspace cannot trigger this unsupported teardown.

This issue was found by our static analysis tool under development.

Fixes: 6732ae5cb47c ("ARM: at91: add pinctrl support")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx>
---
drivers/pinctrl/pinctrl-at91.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 0a57ed51d4c9..81b58a7a44be 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1911,6 +1911,7 @@ static DEFINE_NOIRQ_DEV_PM_OPS(at91_gpio_pm_ops, at91_gpio_suspend, at91_gpio_re
static struct platform_driver at91_gpio_driver = {
.driver = {
.name = "gpio-at91",
+ .suppress_bind_attrs = true,
.of_match_table = at91_gpio_of_match,
.pm = pm_sleep_ptr(&at91_gpio_pm_ops),
},
@@ -1920,6 +1921,7 @@ static struct platform_driver at91_gpio_driver = {
static struct platform_driver at91_pinctrl_driver = {
.driver = {
.name = "pinctrl-at91",
+ .suppress_bind_attrs = true,
.of_match_table = at91_pinctrl_of_match,
},
.probe = at91_pinctrl_probe,

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4