mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] ASoC: SOF: debug: fix possible memory leak in sof_dfsentry_write()
@ 2019-07-05  8:16 Wei Yongjun
  2019-07-05 16:37 ` [alsa-devel] " Ranjani Sridharan
  2019-07-05 17:19 ` Applied "ASoC: SOF: debug: fix possible memory leak in sof_dfsentry_write()" to the asoc tree Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2019-07-05  8:16 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Pierre-Louis Bossart, Ranjani Sridharan, Pan Xiuli
  Cc: Wei Yongjun, alsa-devel, linux-kernel, kernel-janitors

'string' is malloced in sof_dfsentry_write() and should be freed
before leaving from the error handling cases, otherwise it will cause
memory leak.

Fixes: 091c12e1f50c ("ASoC: SOF: debug: add new debugfs entries for IPC flood test")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 sound/soc/sof/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c
index 54bb53bfc81b..2388477a965e 100644
--- a/sound/soc/sof/debug.c
+++ b/sound/soc/sof/debug.c
@@ -162,7 +162,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
 	else
 		ret = kstrtoul(string, 0, &ipc_count);
 	if (ret < 0)
-		return ret;
+		goto out;
 
 	/* limit max duration/ipc count for flood test */
 	if (flood_duration_test) {
@@ -191,7 +191,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
 				    "error: debugfs write failed to resume %d\n",
 				    ret);
 		pm_runtime_put_noidle(sdev->dev);
-		return ret;
+		goto out;
 	}
 
 	/* flood test */




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-05 17:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-05  8:16 [PATCH -next] ASoC: SOF: debug: fix possible memory leak in sof_dfsentry_write() Wei Yongjun
2019-07-05 16:37 ` [alsa-devel] " Ranjani Sridharan
2019-07-05 17:19 ` Applied "ASoC: SOF: debug: fix possible memory leak in sof_dfsentry_write()" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome