2019-03-29 14:12:17 +08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-10-16 02:05:43 +08:00
|
|
|
From: "Shaik, ShahinaX" <shahinax.shaik@intel.com>
|
|
|
|
Date: Thu, 29 Mar 2018 21:40:15 +0530
|
2019-03-29 14:12:17 +08:00
|
|
|
Subject: [PATCH] ASoC: Intel: Skylake: Fix Audio memory leakage at boot time
|
2018-10-16 02:05:43 +08:00
|
|
|
|
|
|
|
Fix kmemleak issues in skl_module_sysfs_init functions by,
|
|
|
|
instead of allocating memory, we use local variable of type
|
|
|
|
"char array" and snprintf to write uuid.
|
|
|
|
|
|
|
|
kmemleak backtrace:
|
|
|
|
|
|
|
|
unreferenced object 0xffff880267946e00 (size 64):
|
|
|
|
comm "insmod", pid 2340, jiffies 4294672904 (age 92.133s)
|
|
|
|
hex dump (first 32 bytes):
|
|
|
|
36 36 42 34 34 30 32 44 2d 42 34 36 38 2d 34 32 66B4402D-B468-42
|
|
|
|
46 32 2d 38 31 41 37 2d 42 33 37 31 32 31 38 36 F2-81A7-B3712186
|
|
|
|
backtrace:
|
|
|
|
[<ffffffff81ae64ca>] kmemleak_alloc+0x4a/0xa0
|
|
|
|
[<ffffffff812006b4>] __kmalloc_track_caller+0x124/0x200
|
|
|
|
[<ffffffff81404126>] kvasprintf+0x66/0xd0
|
|
|
|
[<ffffffff8140427e>] kasprintf+0x4e/0x70
|
|
|
|
[<ffffffffc035dafa>] skl_module_sysfs_init+0x13a/0x260 [snd_soc_skl_ipc]
|
|
|
|
[<ffffffffc036f906>] skl_platform_soc_probe+0x246/0x480 [snd_soc_skl]
|
|
|
|
[<ffffffff818f5a0c>] snd_soc_platform_drv_probe+0x1c/0x20
|
|
|
|
[<ffffffff818f9307>] soc_probe_component+0x227/0x3c0
|
|
|
|
[<ffffffff818fb857>] snd_soc_register_card+0x687/0xf00
|
|
|
|
[<ffffffffc03910ba>] broxton_tdf8532_audio_probe+0x3a/0x3d [snd_soc_sst_bxt_tdf8532]
|
|
|
|
[<ffffffff8164283e>] platform_drv_probe+0x3e/0xa0
|
|
|
|
[<ffffffff8164066f>] driver_probe_device+0xef/0x410
|
|
|
|
[<ffffffff81640a37>] __driver_attach+0xa7/0xf0
|
|
|
|
[<ffffffff8163e130>] bus_for_each_dev+0x70/0xc0
|
|
|
|
[<ffffffff8163fefe>] driver_attach+0x1e/0x20
|
|
|
|
[<ffffffff8163f987>] bus_add_driver+0x1c7/0x270
|
|
|
|
|
|
|
|
Change-Id: Ib326d4400c0d7ac6cd4ad36a2dd006663837cee7
|
|
|
|
Signed-off-by: Shaik, ShahinaX <shahinax.shaik@intel.com>
|
|
|
|
Reviewed-on:
|
|
|
|
Reviewed-by: Shaik, Kareem M <kareem.m.shaik@intel.com>
|
|
|
|
Reviewed-by: Singh, Guneshwor O <guneshwor.o.singh@intel.com>
|
|
|
|
Reviewed-by: Babu, Ramesh <ramesh.babu@intel.com>
|
|
|
|
Reviewed-by: Kale, Sanyog R <sanyog.r.kale@intel.com>
|
|
|
|
Reviewed-by: Koul, Vinod <vinod.koul@intel.com>
|
|
|
|
Tested-by: Madiwalar, MadiwalappaX <madiwalappax.madiwalar@intel.com>
|
|
|
|
---
|
|
|
|
sound/soc/intel/skylake/skl-sst-utils.c | 7 ++++---
|
|
|
|
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
|
2020-10-27 02:14:06 +08:00
|
|
|
index 668e7d020a9c..7c867426b39b 100644
|
2018-10-16 02:05:43 +08:00
|
|
|
--- a/sound/soc/intel/skylake/skl-sst-utils.c
|
|
|
|
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
|
|
|
|
@@ -1178,10 +1178,11 @@ int skl_module_sysfs_init(struct skl_sst *ctx, struct kobject *kobj)
|
|
|
|
{
|
|
|
|
struct uuid_module *module;
|
|
|
|
struct skl_sysfs_module *modinfo_obj;
|
|
|
|
- char *uuid_name;
|
|
|
|
int count = 0;
|
|
|
|
int max_mod = 0;
|
|
|
|
int ret = 0;
|
|
|
|
+ unsigned int uuid_size = sizeof(module->uuid);
|
|
|
|
+ char uuid_name[uuid_size];
|
|
|
|
|
|
|
|
if (list_empty(&ctx->uuid_list))
|
|
|
|
return 0;
|
|
|
|
@@ -1218,7 +1219,7 @@ int skl_module_sysfs_init(struct skl_sst *ctx, struct kobject *kobj)
|
|
|
|
goto err_sysfs_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
- uuid_name = kasprintf(GFP_KERNEL, "%pUL", &module->uuid);
|
|
|
|
+ snprintf(uuid_name, sizeof(uuid_name), "%pUL", &module->uuid);
|
|
|
|
ret = kobject_init_and_add(&modinfo_obj->kobj, &uuid_ktype,
|
|
|
|
ctx->sysfs_tree->modules_kobj, uuid_name);
|
|
|
|
if (ret < 0)
|
|
|
|
@@ -1240,7 +1241,7 @@ int skl_module_sysfs_init(struct skl_sst *ctx, struct kobject *kobj)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_sysfs_exit:
|
|
|
|
- skl_module_sysfs_exit(ctx);
|
|
|
|
+ skl_module_sysfs_exit(ctx);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
--
|
2019-04-08 18:08:36 +08:00
|
|
|
https://clearlinux.org
|
2018-10-16 02:05:43 +08:00
|
|
|
|