diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2024-10-23 11:39:47 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2024-10-28 13:54:04 +0100 |
commit | 5a18e2be454f51c7f698d47d8b2cf3b92a5a3ec1 (patch) | |
tree | 47e4b67734af1ef26ac8c3a65e861776df80073f /drivers/pinctrl | |
parent | 3ad8d3ec6d87b16cdd336aa065d8e150096a192b (diff) | |
download | lwn-5a18e2be454f51c7f698d47d8b2cf3b92a5a3ec1.tar.gz lwn-5a18e2be454f51c7f698d47d8b2cf3b92a5a3ec1.zip |
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 3fd976afe974 ("pinctrl: nuvoton: fix a double free in
ma35_pinctrl_dt_node_to_map_func()") and 4575962aeed6 ("pinctrl: sophgo:
fix double free in cv1800_pctrl_dt_node_to_map()").
Fixes: a83c29e1d145 ("pinctrl: spacemit: add support for SpacemiT K1 SoC")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Yixun Lan <dlan@gentoo.org>
Link: https://lore.kernel.org/4b5f1306-dc01-4edc-96d3-b232b930ddf2@stanley.mountain
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/spacemit/pinctrl-k1.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pinctrl/spacemit/pinctrl-k1.c b/drivers/pinctrl/spacemit/pinctrl-k1.c index c75ea27b2344..a32579d73613 100644 --- a/drivers/pinctrl/spacemit/pinctrl-k1.c +++ b/drivers/pinctrl/spacemit/pinctrl-k1.c @@ -314,7 +314,7 @@ static int spacemit_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; |