* [patch] ASoC: Baytrail: fix error handling in sst_byt_dsp_init()
@ 2014-03-05 11:11 Dan Carpenter
2014-03-05 19:18 ` [alsa-devel] " Liam Girdwood
2014-03-06 4:22 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-03-05 11:11 UTC (permalink / raw)
To: Liam Girdwood
Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, Jarkko Nikula,
alsa-devel, kernel-janitors
Calling "kfree(byt)" is a double free because that was allocated with
devm_kzalloc(). There were a couple places which leak "byt->msg". That
memory is allocated in msg_empty_list_init().
Fixes: f7d01fd6754c ('ASoC: Intel: Add Intel Baytrail SST DSP IPC support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/sound/soc/intel/sst-baytrail-ipc.c b/sound/soc/intel/sst-baytrail-ipc.c
index c12e194bbc6b..d0eaeee21be4 100644
--- a/sound/soc/intel/sst-baytrail-ipc.c
+++ b/sound/soc/intel/sst-baytrail-ipc.c
@@ -796,7 +796,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata)
err = msg_empty_list_init(byt);
if (err < 0)
- goto list_err;
+ return -ENOMEM;
/* start the IPC message thread */
init_kthread_worker(&byt->kworker);
@@ -806,7 +806,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata)
if (IS_ERR(byt->tx_thread)) {
err = PTR_ERR(byt->tx_thread);
dev_err(byt->dev, "error failed to create message TX task\n");
- goto list_err;
+ goto err_free_msg;
}
init_kthread_work(&byt->kwork, sst_byt_ipc_tx_msgs);
@@ -816,7 +816,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata)
byt->dsp = sst_dsp_new(dev, &byt_dev, pdata);
if (byt->dsp == NULL) {
err = -ENODEV;
- goto list_err;
+ goto err_free_msg;
}
/* keep the DSP in reset state for base FW loading */
@@ -848,9 +848,9 @@ boot_err:
sst_fw_free(byt_sst_fw);
fw_err:
sst_dsp_free(byt->dsp);
+err_free_msg:
kfree(byt->msg);
-list_err:
- kfree(byt);
+
return err;
}
EXPORT_SYMBOL_GPL(sst_byt_dsp_init);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [alsa-devel] [patch] ASoC: Baytrail: fix error handling in sst_byt_dsp_init()
2014-03-05 11:11 [patch] ASoC: Baytrail: fix error handling in sst_byt_dsp_init() Dan Carpenter
@ 2014-03-05 19:18 ` Liam Girdwood
2014-03-06 4:22 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2014-03-05 19:18 UTC (permalink / raw)
To: Dan Carpenter
Cc: Liam Girdwood, alsa-devel, Takashi Iwai, kernel-janitors,
Mark Brown, Jarkko Nikula
On Wed, 2014-03-05 at 14:11 +0300, Dan Carpenter wrote:
> Calling "kfree(byt)" is a double free because that was allocated with
> devm_kzalloc(). There were a couple places which leak "byt->msg". That
> memory is allocated in msg_empty_list_init().
>
Thanks, we've just fixed this too but were not quicker than you for
upstreaming ;)
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] ASoC: Baytrail: fix error handling in sst_byt_dsp_init()
2014-03-05 11:11 [patch] ASoC: Baytrail: fix error handling in sst_byt_dsp_init() Dan Carpenter
2014-03-05 19:18 ` [alsa-devel] " Liam Girdwood
@ 2014-03-06 4:22 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-03-06 4:22 UTC (permalink / raw)
To: Dan Carpenter
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Jarkko Nikula,
alsa-devel, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 276 bytes --]
On Wed, Mar 05, 2014 at 02:11:57PM +0300, Dan Carpenter wrote:
> Calling "kfree(byt)" is a double free because that was allocated with
> devm_kzalloc(). There were a couple places which leak "byt->msg". That
> memory is allocated in msg_empty_list_init().
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-06 4:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-05 11:11 [patch] ASoC: Baytrail: fix error handling in sst_byt_dsp_init() Dan Carpenter
2014-03-05 19:18 ` [alsa-devel] " Liam Girdwood
2014-03-06 4:22 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).