[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4d08ed12-48fa-ed7f-3988-8d040c64acb1@linux.intel.com>
Date: Sun, 27 Oct 2019 20:47:42 -0500
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: Navid Emamdoost <navid.emamdoost@...il.com>
Cc: emamd001@....edu, kjlu@....edu, smccaman@....edu,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Wei Yongjun <weiyongjun1@...wei.com>,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ASoC: SOF: Fix memory leak in sof_dfsentry_write
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@...il.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.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;
>
Powered by blists - more mailing lists