diff options
author | Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> | 2024-10-10 04:18:18 -0700 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2024-10-10 21:12:59 +0200 |
commit | 4575962aeed63aca975756852ab0c550164f849f (patch) | |
tree | 6cea06bcc1a5f1b5502de18445163c67a9fa6af3 | |
parent | c9560baef0fa95aa676b7c7a7532543a4c6ff80c (diff) | |
download | lwn-4575962aeed63aca975756852ab0c550164f849f.tar.gz lwn-4575962aeed63aca975756852ab0c550164f849f.zip |
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: a29d8e93e710 ("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>
-rw-r--r-- | drivers/pinctrl/sophgo/pinctrl-cv18xx.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pinctrl/sophgo/pinctrl-cv18xx.c b/drivers/pinctrl/sophgo/pinctrl-cv18xx.c index d18fc5aa84f7..57f2674e75d6 100644 --- a/drivers/pinctrl/sophgo/pinctrl-cv18xx.c +++ b/drivers/pinctrl/sophgo/pinctrl-cv18xx.c @@ -221,7 +221,7 @@ static int cv1800_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, if (!grpnames) return -ENOMEM; - map = devm_kcalloc(dev, ngroups * 2, sizeof(*map), GFP_KERNEL); + map = kcalloc(ngroups * 2, sizeof(*map), GFP_KERNEL); if (!map) return -ENOMEM; |