driver: regmap: set debugfs_name to NULL after it is freed
Subsystems (2)
PATCH 1/1 driver: regmap: set debugfs_name to NULL after it is freed
From: Meng Li <[email protected]>
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.
--- drivers/base/regmap/regmap-debugfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/base/regmap/regmap-debugfs.c +1 -0
@@ -661,6 +661,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;
Signature · 1 line
2.17.1
Please discard this email. There is a wrong email address in TO list. I have sent another one.
Thanks,
Limeng
Quoted 45 lines
-----Original Message-----
From: Li, Meng <[email protected]>
Sent: Friday, February 26, 2021 10:16 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: Li, Meng <[email protected]>
Subject: [PATCH] driver: regmap: setdebugfs_nameto NULL after it is freedFrom: Meng Li <[email protected]>
There is a upstream commit cffa4b2122f5("regmap:debugfs:
Fix a memory leak when callingregmap_attach_dev") that adds a if condition when create name fordebugfs_name.
With below function invoking logical,debugfs_nameis freed inregmap_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_nameto NULL after it is freed.Fixes cffa4b2122f5("regmap: debugfs: Fix a memory leak when calling
regmap_attach_dev")Signed-off-by Meng Li <[email protected]>--- drivers/base/regmap/regmap-debugfs.c | 1 + 1 file changed, 1 insertion(+)drivers/base/regmap/regmap-debugfs.c +1
-1@@ -661,6 +661,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; --2.17.1