Skip to content

Commit 5a18e2b

Browse files
Dan Carpenterlinusw
authored andcommitted
pinctrl: spacemit: fix double free of map
The map pointer is freed by pinctrl_utils_free_map(). It must not be a devm_ pointer or it leads to a double free when the device is unloaded. This is similar to a couple bugs Harshit Mogalapalli fixed earlier in commits 3fd976a ("pinctrl: nuvoton: fix a double free in ma35_pinctrl_dt_node_to_map_func()") and 4575962 ("pinctrl: sophgo: fix double free in cv1800_pctrl_dt_node_to_map()"). Fixes: a83c29e ("pinctrl: spacemit: add support for SpacemiT K1 SoC") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Yixun Lan <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 3ad8d3e commit 5a18e2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pinctrl/spacemit/pinctrl-k1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static int spacemit_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
314314
if (!grpnames)
315315
return -ENOMEM;
316316

317-
map = devm_kcalloc(dev, ngroups * 2, sizeof(*map), GFP_KERNEL);
317+
map = kcalloc(ngroups * 2, sizeof(*map), GFP_KERNEL);
318318
if (!map)
319319
return -ENOMEM;
320320

0 commit comments

Comments
 (0)