From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org, vkoul@kernel.org,
gregkh@linuxfoundation.org,
Bard liao <yung-chuan.liao@linux.intel.com>,
Rander Wang <rander.wang@linux.intel.com>,
linux-kernel@vger.kernel.org,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Daniel Baluta <daniel.baluta@gmail.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Subject: [PATCH] regmap: fix memory leak with map->patch
Date: Wed, 17 Jun 2020 11:39:00 -0500 [thread overview]
Message-ID: <20200617163900.17674-1-pierre-louis.bossart@linux.intel.com> (raw)
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
next reply other threads:[~2020-06-17 16:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 16:39 Pierre-Louis Bossart [this message]
2020-06-17 18:26 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200617163900.17674-1-pierre-louis.bossart@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=daniel.baluta@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=guennadi.liakhovetski@linux.intel.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rander.wang@linux.intel.com \
--cc=tiwai@suse.de \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®