Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH] ASoC: SOF: Fix memory leak in sof_dfsentry_write
@ 2019-10-27 19:48 Navid Emamdoost
  2019-10-28  1:47 ` Pierre-Louis Bossart
  2019-10-28 14:56 ` [alsa-devel] Applied "ASoC: SOF: Fix memory leak in sof_dfsentry_write" to the asoc tree Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Navid Emamdoost @ 2019-10-27 19:48 UTC (permalink / raw)
  Cc: Pierre-Louis Bossart, alsa-devel, Greg Kroah-Hartman,
	Takashi Iwai, kjlu, Liam Girdwood, Mark Brown, Wei Yongjun,
	Ranjani Sridharan, smccaman, Navid Emamdoost, linux-kernel,
	emamd001

In the implementation of sof_dfsentry_write() memory allocated for
string is leaked in case of an error. Go to error handling path if the
d_name.name is not valid.

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

diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c
index 54cd431faab7..5529e8eeca46 100644
--- a/sound/soc/sof/debug.c
+++ b/sound/soc/sof/debug.c
@@ -152,8 +152,10 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
 	 */
 	dentry = file->f_path.dentry;
 	if (strcmp(dentry->d_name.name, "ipc_flood_count") &&
-	    strcmp(dentry->d_name.name, "ipc_flood_duration_ms"))
-		return -EINVAL;
+	    strcmp(dentry->d_name.name, "ipc_flood_duration_ms")) {
+		ret = -EINVAL;
+		goto out;
+	}
 
 	if (!strcmp(dentry->d_name.name, "ipc_flood_duration_ms"))
 		flood_duration_test = true;
-- 
2.17.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

end of thread, other threads:[~2019-10-28 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-27 19:48 [alsa-devel] [PATCH] ASoC: SOF: Fix memory leak in sof_dfsentry_write Navid Emamdoost
2019-10-28  1:47 ` Pierre-Louis Bossart
2019-10-28 14:56 ` [alsa-devel] Applied "ASoC: SOF: Fix 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