Messages in this thread Patch in this message | | | Date | Thu, 6 Jan 2022 17:31:45 +0000 | From | Mark Brown <> | Subject | Re: [PATCH] regmap: debugfs: Free the previous allocated debugfs_name buffer |
| |
On Thu, Jan 06, 2022 at 02:15:37PM -0300, Fabio Estevam wrote:
> debugfs: Directory 'dummy-iomuxc-gpr@20e0000' with parent 'regmap' already present! > > By inspecting the duplicate directory name: > > [ 0.274418] platform panel: Fixing up cyclic dependency with ldb > [ 0.276896] ************ 1: devname is dummy > [ 0.276926] ************ 2: name is iomuxc-gpr@20e0000
It's quite hard to read these kernel logs and tie them into anything - they're fairly verbose and weirdly formatted with all the *********s.
> +++ b/drivers/base/regmap/regmap-debugfs.c > @@ -589,6 +589,7 @@ void regmap_debugfs_init(struct regmap *map) > return; > } > name = map->debugfs_name; > + kfree(map->debugfs_name); > } else { > name = devname; > } > @@ -600,6 +601,7 @@ void regmap_debugfs_init(struct regmap *map) > if (!map->debugfs_name) > return; > name = map->debugfs_name; > + kfree(map->debugfs_name);
This is fairly clearly introducing a use after free bug - we've taken a copy of map->debugfs_name in name then immediately free map->debugfs_name so any use of name will be referencing freed memory. If this works it will be because something went and zeroed the memory, it's just as likely to cause us to crash. [unhandled content-type:application/pgp-signature] | |