Skip to content

Commit e41a962

Browse files
limeng-linuxbroonie
authored andcommitted
regmap: set debugfs_name to NULL after it is freed
There is a upstream commit cffa4b2("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: cffa4b2 ("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>
1 parent a38fd87 commit e41a962

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/base/regmap/regmap-debugfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ void regmap_debugfs_exit(struct regmap *map)
660660
regmap_debugfs_free_dump_cache(map);
661661
mutex_unlock(&map->cache_lock);
662662
kfree(map->debugfs_name);
663+
map->debugfs_name = NULL;
663664
} else {
664665
struct regmap_debugfs_node *node, *tmp;
665666

0 commit comments

Comments
 (0)