[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CD6925E8781EFD4D8E11882D20FC406D529FE5A9@SHSMSX104.ccr.corp.intel.com>
Date: Tue, 6 Nov 2018 00:58:30 +0000
From: "He, Bo" <bo.he@...el.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
"alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "liam.r.girdwood@...ux.intel.com" <liam.r.girdwood@...ux.intel.com>,
"perex@...ex.cz" <perex@...ex.cz>,
"tiwai@...e.com" <tiwai@...e.com>,
"Singh, Guneshwor O" <guneshwor.o.singh@...el.com>,
"Periyasamy, SriramX" <sriramx.periyasamy@...el.com>,
"Kale, Sanyog R" <sanyog.r.kale@...el.com>,
"Kesapragada, Pardha Saradhi" <pardha.saradhi.kesapragada@...el.com>,
"kuninori.morimoto.gx@...esas.com" <kuninori.morimoto.gx@...esas.com>,
"Ughreja, Rakesh A" <rakesh.a.ughreja@...el.com>,
"Prakash, Divya1" <divya1.prakash@...el.com>,
"Diwakar, Praveen" <praveen.diwakar@...el.com>,
"Zhang, Yanmin" <yanmin.zhang@...el.com>
Subject: RE: [alsa-devel] [PATCH] fix the kernel panic due to wrong use the
dev memory API
Hi,
I submit the patch based on tag v4.19.
-----Original Message-----
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
Sent: Tuesday, November 6, 2018 1:02 AM
To: He, Bo <bo.he@...el.com>; alsa-devel@...a-project.org; linux-kernel@...r.kernel.org
Cc: liam.r.girdwood@...ux.intel.com; perex@...ex.cz; tiwai@...e.com; Singh, Guneshwor O <guneshwor.o.singh@...el.com>; Periyasamy, SriramX <sriramx.periyasamy@...el.com>; Kale, Sanyog R <sanyog.r.kale@...el.com>; Kesapragada, Pardha Saradhi <pardha.saradhi.kesapragada@...el.com>; kuninori.morimoto.gx@...esas.com; guruprasadx.pawse@...el.com; Ughreja, Rakesh A <rakesh.a.ughreja@...el.com>; Prakash, Divya1 <divya1.prakash@...el.com>; Diwakar, Praveen <praveen.diwakar@...el.com>; Zhang, Yanmin <yanmin.zhang@...el.com>
Subject: Re: [alsa-devel] [PATCH] fix the kernel panic due to wrong use the dev memory API
On 11/5/18 2:29 AM, He, Bo wrote:
> skl->dais is allocated with devm_kcalloc, can't free with
> the krealloc. Memory allocated with devm API is automatically freed on
> driver detach, Like all other devres resources.
>
> Refer to drivers/base/devres.c devm_kmalloc for more details.
What code are you looking at?
I see this in the Mark's tree
int skl_platform_register(struct device *dev) {
int ret;
struct snd_soc_dai_driver *dais;
int num_dais = ARRAY_SIZE(skl_platform_dai);
struct hdac_bus *bus = dev_get_drvdata(dev);
struct skl *skl = bus_to_skl(bus);
INIT_LIST_HEAD(&skl->ppl_list);
INIT_LIST_HEAD(&skl->bind_list);
skl->dais = kmemdup(skl_platform_dai, sizeof(skl_platform_dai),
GFP_KERNEL);
if (!skl->dais) {
ret = -ENOMEM;
goto err;
}
if (!skl->use_tplg_pcm) {
dais = krealloc(skl->dais, sizeof(skl_fe_dai) +
sizeof(skl_platform_dai), GFP_KERNEL);
No trace of devm as you mention it? I checked the Chrome tree as well and it's not there.
What am I missing?
>
> Signed-off-by: he, bo <bo.he@...el.com>
> ---
> sound/soc/intel/skylake/skl-pcm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/sound/soc/intel/skylake/skl-pcm.c
> b/sound/soc/intel/skylake/skl-pcm.c
> index 823e391..928d314 100644
> --- a/sound/soc/intel/skylake/skl-pcm.c
> +++ b/sound/soc/intel/skylake/skl-pcm.c
> @@ -1438,7 +1438,8 @@ int skl_platform_register(struct device *dev)
> }
>
> if (!skl->use_tplg_pcm) {
> - dais = krealloc(skl->dais, sizeof(skl_fe_dai) +
> + devm_kfree(dev, skl->dais);
> + dais = devm_kcalloc(dev, skl->dais, sizeof(skl_fe_dai) +
> sizeof(skl_platform_dai), GFP_KERNEL);
> if (!dais) {
> ret = -ENOMEM;
> @@ -1472,7 +1473,5 @@ int skl_platform_unregister(struct device *dev)
> }
> }
>
> - kfree(skl->dais);
> -
> return 0;
> }
Powered by blists - more mailing lists