Commit c0a333d8 authored by Navid Emamdoost's avatar Navid Emamdoost Committed by Mark Brown

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: 091c12e1 ("ASoC: SOF: debug: add new debugfs entries for IPC flood test")
Signed-off-by: default avatarNavid Emamdoost <navid.emamdoost@gmail.com>
Link: https://lore.kernel.org/r/20191027194856.4056-1-navid.emamdoost@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f792bd17
...@@ -152,8 +152,10 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer, ...@@ -152,8 +152,10 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
*/ */
dentry = file->f_path.dentry; dentry = file->f_path.dentry;
if (strcmp(dentry->d_name.name, "ipc_flood_count") && if (strcmp(dentry->d_name.name, "ipc_flood_count") &&
strcmp(dentry->d_name.name, "ipc_flood_duration_ms")) strcmp(dentry->d_name.name, "ipc_flood_duration_ms")) {
return -EINVAL; ret = -EINVAL;
goto out;
}
if (!strcmp(dentry->d_name.name, "ipc_flood_duration_ms")) if (!strcmp(dentry->d_name.name, "ipc_flood_duration_ms"))
flood_duration_test = true; flood_duration_test = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment