Re: [PATCH] pinctrl: pinconf-generic: Fix memory leak in pinconf_generic_parse_dt_config()

From: Linus Walleij

Date: Tue Feb 24 2026 - 03:51:26 EST


On Sat, Feb 14, 2026 at 4:14 PM Felix Gu <ustc.gu@xxxxxxxxx> wrote:

> In pinconf_generic_parse_dt_config(), if parse_dt_cfg() fails, it returns
> directly. This bypasses the cleanup logic and results in a memory leak of
> the cfg buffer.
>
> Fix this by jumping to the out label on failure, ensuring kfree(cfg) is
> called before returning.
>
> Fixes: 90a18c512884 ("pinctrl: pinconf-generic: Handle string values for generic properties")
> Signed-off-by: Felix Gu <ustc.gu@xxxxxxxxx>

Patch applied for fixes.

Yours,
Linus Walleij