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: 90a18c5128 ("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>
master
parent
09a30b7a03
commit
7a648d598c
|
|
@ -351,13 +351,13 @@ int pinconf_generic_parse_dt_config(struct device_node *np,
|
|||
|
||||
ret = parse_dt_cfg(np, dt_params, ARRAY_SIZE(dt_params), cfg, &ncfg);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out;
|
||||
if (pctldev && pctldev->desc->num_custom_params &&
|
||||
pctldev->desc->custom_params) {
|
||||
ret = parse_dt_cfg(np, pctldev->desc->custom_params,
|
||||
pctldev->desc->num_custom_params, cfg, &ncfg);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* no configs found at all */
|
||||
|
|
|
|||
Loading…
Reference in New Issue