Skip to content

Commit 4575962

Browse files
harshimogalapallilinusw
authored andcommitted
pinctrl: sophgo: fix double free in cv1800_pctrl_dt_node_to_map()
'map' is allocated using devm_* which takes care of freeing the allocated data, but in error paths there is a call to pinctrl_utils_free_map() which also does kfree(map) which leads to a double free. Use kcalloc() instead of devm_kcalloc() as freeing is manually handled. Fixes: a29d8e9 ("pinctrl: sophgo: add support for CV1800B SoC") Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Link: https://lore.kernel.org/20241010111830.3474719-1-harshit.m.mogalapalli@oracle.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent c9560ba commit 4575962

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pinctrl/sophgo/pinctrl-cv18xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static int cv1800_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
221221
if (!grpnames)
222222
return -ENOMEM;
223223

224-
map = devm_kcalloc(dev, ngroups * 2, sizeof(*map), GFP_KERNEL);
224+
map = kcalloc(ngroups * 2, sizeof(*map), GFP_KERNEL);
225225
if (!map)
226226
return -ENOMEM;
227227

0 commit comments

Comments
 (0)