2015-04-16 13:50:01

by weiyj_lk

[permalink] [raw]
Subject: [PATCH -next] ASoC: Intel: sst_hsw: remove kfree for memory allocated with devm_kzalloc

From: Wei Yongjun <[email protected]>

It's not necessary to free memory allocated with devm_kzalloc
and using kfree leads to a double free.

Signed-off-by: Wei Yongjun <[email protected]>
---
sound/soc/intel/haswell/sst-haswell-ipc.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/sound/soc/intel/haswell/sst-haswell-ipc.c b/sound/soc/intel/haswell/sst-haswell-ipc.c
index 344a1e9..324eceb 100644
--- a/sound/soc/intel/haswell/sst-haswell-ipc.c
+++ b/sound/soc/intel/haswell/sst-haswell-ipc.c
@@ -2201,7 +2201,6 @@ dma_err:
dsp_new_err:
sst_ipc_fini(ipc);
ipc_init_err:
- kfree(hsw);
return ret;
}
EXPORT_SYMBOL_GPL(sst_hsw_dsp_init);


2015-04-16 14:08:58

by Jarkko Nikula

[permalink] [raw]
Subject: Re: [PATCH -next] ASoC: Intel: sst_hsw: remove kfree for memory allocated with devm_kzalloc

On 04/16/2015 04:46 PM, [email protected] wrote:
> From: Wei Yongjun <[email protected]>
>
> It's not necessary to free memory allocated with devm_kzalloc
> and using kfree leads to a double free.
>
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> sound/soc/intel/haswell/sst-haswell-ipc.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/sound/soc/intel/haswell/sst-haswell-ipc.c b/sound/soc/intel/haswell/sst-haswell-ipc.c
> index 344a1e9..324eceb 100644
> --- a/sound/soc/intel/haswell/sst-haswell-ipc.c
> +++ b/sound/soc/intel/haswell/sst-haswell-ipc.c
> @@ -2201,7 +2201,6 @@ dma_err:
> dsp_new_err:
> sst_ipc_fini(ipc);
> ipc_init_err:
> - kfree(hsw);
> return ret;
> }
> EXPORT_SYMBOL_GPL(sst_hsw_dsp_init);
>
Similar case than with baytrail. Here introduced by commit 0e7921e9583b
("ASoC: Intel: Use the generic IPC/mailbox APIs in Broadwell")

Reviewed-by: Jarkko Nikula <[email protected]>

2015-04-16 21:34:51

by Jin Yao

[permalink] [raw]
Subject: Re: [alsa-devel] [PATCH -next] ASoC: Intel: sst_hsw: remove kfree for memory allocated with devm_kzalloc

For HSW, a patch "[PATCH] ASoC: Intel: Remove invalid kfree of devm
allocated data" to fix this issue has been applied.

But yes, we also need a similar patch for Baytrail.

Thanks
Jin Yao

On 2015/4/16 22:08, Jarkko Nikula wrote:
> On 04/16/2015 04:46 PM, [email protected] wrote:
>> From: Wei Yongjun <[email protected]>
>>
>> It's not necessary to free memory allocated with devm_kzalloc
>> and using kfree leads to a double free.
>>
>> Signed-off-by: Wei Yongjun <[email protected]>
>> ---
>> sound/soc/intel/haswell/sst-haswell-ipc.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/sound/soc/intel/haswell/sst-haswell-ipc.c
>> b/sound/soc/intel/haswell/sst-haswell-ipc.c
>> index 344a1e9..324eceb 100644
>> --- a/sound/soc/intel/haswell/sst-haswell-ipc.c
>> +++ b/sound/soc/intel/haswell/sst-haswell-ipc.c
>> @@ -2201,7 +2201,6 @@ dma_err:
>> dsp_new_err:
>> sst_ipc_fini(ipc);
>> ipc_init_err:
>> - kfree(hsw);
>> return ret;
>> }
>> EXPORT_SYMBOL_GPL(sst_hsw_dsp_init);
>>
> Similar case than with baytrail. Here introduced by commit 0e7921e9583b
> ("ASoC: Intel: Use the generic IPC/mailbox APIs in Broadwell")
>
> Reviewed-by: Jarkko Nikula <[email protected]>
> _______________________________________________
> Alsa-devel mailing list
> [email protected]
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

2015-04-17 14:09:57

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH -next] ASoC: Intel: sst_hsw: remove kfree for memory allocated with devm_kzalloc

On Thu, Apr 16, 2015 at 09:46:18PM +0800, [email protected] wrote:
> From: Wei Yongjun <[email protected]>
>
> It's not necessary to free memory allocated with devm_kzalloc
> and using kfree leads to a double free.

Like Yao said a fix for this has already been applied.


Attachments:
(No filename) (283.00 B)
signature.asc (473.00 B)
Digital signature
Download all attachments