[PATCH] pinctrl: at91: Fix potential use-after-free on manual unbind
Nicolas.Ferre at microchip.com
Nicolas.Ferre at microchip.com
Sun Nov 22 05:00:37 PST 2026
On 20/11/2026 at 18:35, Guangshuo Li wrote:
> 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.
Well, who will ever want to remove gpio or pinctrl on these platforms,
knowing that it's one and only IP for the two?
Does it have a real use-case?
I don't see the point.
Regards,
Nicolas
> Fixes: 6732ae5cb47c ("ARM: at91: add pinctrl support")
> Cc: stable at vger.kernel.org
> Signed-off-by: Guangshuo Li <liguangshuo at mail.sdu.edu.cn>
> ---
> 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
More information about the linux-arm-kernel
mailing list