]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
pinctrl: pinconf-generic: Fix memory leak in pinconf_generic_parse_dt_config()
authorFelix Gu <ustc.gu@gmail.com>
Sat, 14 Feb 2026 15:14:51 +0000 (23:14 +0800)
committerLinus Walleij <linusw@kernel.org>
Tue, 24 Feb 2026 09:51:29 +0000 (10:51 +0100)
commit7a648d598cb8e8c62af3f0e020a25820a3f3a9a7
tree978886172b4afe47f08ee4a5feccf083be0b2a8b
parent09a30b7a035f9f4ac918c8a9af89d70e43462152
pinctrl: pinconf-generic: Fix memory leak in pinconf_generic_parse_dt_config()

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@gmail.com>
Reviewed-by: Antonio Borneo <antonio.borneo@foss.st.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
drivers/pinctrl/pinconf-generic.c