]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pinctrl: s32cc: initialize gpio_pin_config::list after kmalloc()
authorJared Kangas <jkangas@redhat.com>
Tue, 11 Nov 2025 21:54:12 +0000 (13:54 -0800)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 18 Nov 2025 22:56:11 +0000 (23:56 +0100)
s32_pmx_gpio_request_enable() does not initialize the newly-allocated
gpio_pin_config::list before adding it to s32_pinctrl::gpio_configs.
This could result in a linked list corruption.

Initialize the new list_head with INIT_LIST_HEAD() to fix this.

Fixes: fd84aaa8173d ("pinctrl: add NXP S32 SoC family support")
Signed-off-by: Jared Kangas <jkangas@redhat.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/nxp/pinctrl-s32cc.c

index 51ecb8d0fb7e8a203e10cbe965dfec308eaa5f30..35511f83d05603f5374e2d09be4b0843c7d7dc53 100644 (file)
@@ -392,6 +392,7 @@ static int s32_pmx_gpio_request_enable(struct pinctrl_dev *pctldev,
 
        gpio_pin->pin_id = offset;
        gpio_pin->config = config;
+       INIT_LIST_HEAD(&gpio_pin->list);
 
        spin_lock_irqsave(&ipctl->gpio_configs_lock, flags);
        list_add(&gpio_pin->list, &ipctl->gpio_configs);