[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201028070207.GB8084@amd>
Date: Wed, 28 Oct 2020 08:02:08 +0100
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Rohit kumar <rohitkr@...eaurora.org>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Mark Brown <broonie@...nel.org>,
Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 072/264] ASoC: qcom: lpass-platform: fix memory leak
Hi!
> From: Rohit kumar <rohitkr@...eaurora.org>
>
> [ Upstream commit 5fd188215d4eb52703600d8986b22311099a5940 ]
>
> lpass_pcm_data is never freed. Free it in close
> ops to avoid memory leak.
AFAICT this introduces memory leaks in the error paths.
Best regards,
Pavel
Signed-off-by: Pavel Machek <pavel@....cz>
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 2f2967247789..9e13a00d8c80 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -81,17 +81,20 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
else
dma_ch = 0;
- if (dma_ch < 0)
+ if (dma_ch < 0) {
+ kfree(data);
return dma_ch;
+ }
drvdata->substream[dma_ch] = substream;
ret = regmap_write(drvdata->lpaif_map,
LPAIF_DMACTL_REG(v, dma_ch, dir), 0);
if (ret) {
+ kfree(data);
dev_err(soc_runtime->dev,
"error writing to rdmactl reg: %d\n", ret);
- return ret;
+ return ret;
}
data->dma_ch = dma_ch;
@@ -103,6 +106,7 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
ret = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
if (ret < 0) {
+ kfree(data);
dev_err(soc_runtime->dev, "setting constraints failed: %d\n",
ret);
return -EINVAL;
--
http://www.livejournal.com/~pavelmachek
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists