提交 e77b259f 编写于 作者: W Wang Hai 提交者: Greg Kroah-Hartman

staging: greybus: audio: Fix possible leak free widgets in gbaudio_dapm_free_controls

In gbaudio_dapm_free_controls(), if one of the widgets is not found, an error
will be returned directly, which will cause the rest to be unable to be freed,
resulting in leak.

This patch fixes the bug. If if one of them is not found, just skip and free the others.

Fixes: 510e340e ("staging: greybus: audio: Add helper APIs for dynamic audio module")
Reported-by: NHulk Robot <hulkci@huawei.com>
Reviewed-by: NVaibhav Agarwal <vaibhav.sr@gmail.com>
Signed-off-by: NWang Hai <wanghai38@huawei.com>
Link: https://lore.kernel.org/r/20201205103827.31244-1-wanghai38@huawei.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 94168e2b
......@@ -135,7 +135,8 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm,
if (!w) {
dev_err(dapm->dev, "%s: widget not found\n",
widget->name);
return -EINVAL;
widget++;
continue;
}
widget++;
#ifdef CONFIG_DEBUG_FS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部