* [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 ` 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: emamd001, kjlu, smccaman, Navid Emamdoost, Liam Girdwood,
Mark Brown, Jaroslav Kysela, Takashi Iwai, Ranjani Sridharan,
Pierre-Louis Bossart, Greg Kroah-Hartman, Wei Yongjun,
alsa-devel, linux-kernel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: SOF: Fix memory leak in sof_dfsentry_write
2019-10-27 19:48 [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 ` Applied "ASoC: SOF: Fix memory leak in sof_dfsentry_write" to the asoc tree Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-28 1:47 UTC (permalink / raw)
To: Navid Emamdoost
Cc: emamd001, kjlu, smccaman, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Ranjani Sridharan,
Greg Kroah-Hartman, Wei Yongjun, alsa-devel, linux-kernel
On 10/27/19 2:48 PM, Navid Emamdoost wrote:
> 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>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.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;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Applied "ASoC: SOF: Fix memory leak in sof_dfsentry_write" to the asoc tree
2019-10-27 19:48 [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 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
To: Navid Emamdoost
Cc: alsa-devel, Cc:, Cc:,
emamd001, Greg Kroah-Hartman, Jaroslav Kysela, kjlu,
Liam Girdwood, linux-kernel, Mark Brown, Pierre-Louis Bossart,
Ranjani Sridharan, smccaman, Takashi Iwai, Wei Yongjun
The patch
ASoC: SOF: Fix memory leak in sof_dfsentry_write
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
From c0a333d842ef67ac04adc72ff79dc1ccc3dca4ed Mon Sep 17 00:00:00 2001
From: Navid Emamdoost <navid.emamdoost@gmail.com>
Date: Sun, 27 Oct 2019 14:48:47 -0500
Subject: [PATCH] ASoC: SOF: Fix memory leak in sof_dfsentry_write
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>
Link: https://lore.kernel.org/r/20191027194856.4056-1-navid.emamdoost@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
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.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-28 14:56 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 [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 ` 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;
as well as URLs for NNTP newsgroup(s).