mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 20:10:23 +09:00
regmap: set debugfs_name to NULL after it is freed
[ Upstream commite41a962f82] There is a upstream commit cffa4b2122f5("regmap:debugfs: Fix a memory leak when calling regmap_attach_dev") that adds a if condition when create name for debugfs_name. With below function invoking logical, debugfs_name is freed in regmap_debugfs_exit(), but it is not created again because of the if condition introduced by above commit. regmap_reinit_cache() regmap_debugfs_exit() ... regmap_debugfs_init() So, set debugfs_name to NULL after it is freed. Fixes:cffa4b2122("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev") Signed-off-by: Meng Li <Meng.Li@windriver.com> Link: https://lore.kernel.org/r/20210226021737.7690-1-Meng.Li@windriver.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
840a6ff50a
commit
eb949f8912
@@ -660,6 +660,7 @@ void regmap_debugfs_exit(struct regmap *map)
|
||||
regmap_debugfs_free_dump_cache(map);
|
||||
mutex_unlock(&map->cache_lock);
|
||||
kfree(map->debugfs_name);
|
||||
map->debugfs_name = NULL;
|
||||
} else {
|
||||
struct regmap_debugfs_node *node, *tmp;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user