diff options
author | Dafna Hirschfeld <dafna.hirschfeld@collabora.com> | 2020-05-06 12:09:03 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2020-05-12 19:45:33 +0200 |
commit | d7faa8ffb6be57bf8233a4b5a636d76b83c51ce7 (patch) | |
tree | 0ad1e1b7b351746f5fec2b2f49f787c8da0e6233 /drivers/slimbus | |
parent | pinctrl: rockchip: return ENOMEM instead of EINVAL if allocation fails (diff) | |
download | linux-d7faa8ffb6be57bf8233a4b5a636d76b83c51ce7.tar.xz linux-d7faa8ffb6be57bf8233a4b5a636d76b83c51ce7.zip |
pinctrl: rockchip: fix memleak in rockchip_dt_node_to_map
In function rockchip_dt_node_to_map, a new_map variable is
allocated by:
new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map),
GFP_KERNEL);
This uses devres and attaches new_map to the pinctrl driver.
This cause a leak since new_map is not released when the probed
driver is removed. Fix it by using kcalloc to allocate new_map
and free it in `rockchip_dt_free_map`
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20200506100903.15420-1-dafna.hirschfeld@collabora.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/slimbus')
0 files changed, 0 insertions, 0 deletions