[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CO1PR11MB4849153C5E31137CADDD250FF19D9@CO1PR11MB4849.namprd11.prod.outlook.com>
Date: Fri, 26 Feb 2021 02:19:18 +0000
From: "Li, Meng" <Meng.Li@...driver.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"broonie@...nel.org" <broonie@...nel.org>,
"rafael@...nel.org" <rafael@...nel.org>
Subject: RE: [PATCH] driver: regmap: set debugfs_name to NULL after it is
freed
Please discard this email. There is a wrong email address in TO list.
I have sent another one.
Thanks,
Limeng
> -----Original Message-----
> From: Li, Meng <Meng.Li@...driver.com>
> Sent: Friday, February 26, 2021 10:16 AM
> To: linux-kernel@...r.kernel.org; broonie@...nel.org;
> regkh@...uxfoundation.org; rafael@...nel.org
> Cc: Li, Meng <Meng.Li@...driver.com>
> Subject: [PATCH] driver: regmap: set debugfs_name to NULL after it is freed
>
> From: Meng Li <Meng.Li@...driver.com>
>
> 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: cffa4b2122f5("regmap: debugfs: Fix a memory leak when calling
> regmap_attach_dev")
> Cc: stable@...r.kernel.org
> Signed-off-by: Meng Li <Meng.Li@...driver.com>
> ---
> drivers/base/regmap/regmap-debugfs.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/base/regmap/regmap-debugfs.c
> b/drivers/base/regmap/regmap-debugfs.c
> index 398991381e9a..4f2ff1b2b450 100644
> --- a/drivers/base/regmap/regmap-debugfs.c
> +++ b/drivers/base/regmap/regmap-debugfs.c
> @@ -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
Powered by blists - more mailing lists