* [PATCH] regmap: fix memory leak with map->patch
@ 2020-06-17 16:39 Pierre-Louis Bossart
2020-06-17 18:26 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Pierre-Louis Bossart @ 2020-06-17 16:39 UTC (permalink / raw)
To: alsa-devel
Cc: tiwai, broonie, vkoul, gregkh, Bard liao, Rander Wang,
linux-kernel, Pierre-Louis Bossart, Daniel Baluta, Kai Vehmanen,
Guennadi Liakhovetski
kmemleak throws the following error on devices using
regmap_register_patch(). map->patch is allocated dynamically with
krealloc() but never freed.
root@Zotac:~/kmod# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff8880641c4e08 (size 96):
comm "systemd-udevd", pid 266, jiffies 4294736541 (age 414.914s)
hex dump (first 32 bytes):
3d 01 00 00 00 36 00 00 00 00 00 00 12 01 00 00 =....6..........
a8 0a 00 00 00 00 00 00 14 01 00 00 aa 0a 00 00 ................
backtrace:
[<00000000f2841faf>] krealloc+0x63/0xc0
[<00000000ed643fb3>] regmap_register_patch+0x68/0x1d0
[<000000001806a5c3>] 0xffffffffc088a5f9
[<00000000f4781e26>] i2c_device_probe+0x462/0x4b0
[<000000009dd7f5f4>] really_probe+0x17f/0x520
[<00000000be42920d>] driver_probe_device+0x114/0x170
[<00000000e5840d3f>] device_driver_attach+0x82/0x90
[<0000000027828801>] __driver_attach+0xa9/0x190
[<0000000085195e73>] bus_for_each_dev+0xe1/0x140
[<0000000070edb38c>] bus_add_driver+0x224/0x2e0
[<000000002d41b24a>] driver_register+0xd3/0x150
[<0000000055dbb3fb>] i2c_register_driver+0x6b/0xd0
[<00000000bf84b954>] do_one_initcall+0x86/0x2a0
[<000000001d939871>] do_init_module+0xf8/0x350
[<00000000267b474f>] load_module+0x41a9/0x44c0
[<000000007d8014dc>] __do_sys_finit_module+0x121/0x1b0
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
drivers/base/regmap/regmap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index c472f624382d..46f4b6322e47 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1357,6 +1357,7 @@ void regmap_exit(struct regmap *map)
if (map->hwlock)
hwspin_lock_free(map->hwlock);
kfree_const(map->name);
+ kfree(map->patch);
kfree(map);
}
EXPORT_SYMBOL_GPL(regmap_exit);
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] regmap: fix memory leak with map->patch
2020-06-17 16:39 [PATCH] regmap: fix memory leak with map->patch Pierre-Louis Bossart
@ 2020-06-17 18:26 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2020-06-17 18:26 UTC (permalink / raw)
To: Pierre-Louis Bossart
Cc: alsa-devel, tiwai, vkoul, gregkh, Bard liao, Rander Wang,
linux-kernel, Daniel Baluta, Kai Vehmanen, Guennadi Liakhovetski
[-- Attachment #1: Type: text/plain, Size: 267 bytes --]
On Wed, Jun 17, 2020 at 11:39:00AM -0500, Pierre-Louis Bossart wrote:
> kmemleak throws the following error on devices using
> regmap_register_patch(). map->patch is allocated dynamically with
> krealloc() but never freed.
Charles sent a patch fixing this already.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-17 18:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 16:39 [PATCH] regmap: fix memory leak with map->patch Pierre-Louis Bossart
2020-06-17 18:26 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®