aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Hai <[email protected]>2020-12-05 18:38:27 +0800
committerGreg Kroah-Hartman <[email protected]>2020-12-07 15:11:09 +0100
commite77b259f67ab99f1e22ce895b9b1c637fd5f2d4c (patch)
tree72037e01186de726f34727e666250d5da0a2a492
parent94168e2ba4dc6a8db033afcd32ad64ab8ec9f09c (diff)
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: 510e340efe0c ("staging: greybus: audio: Add helper APIs for dynamic audio module") Reported-by: Hulk Robot <[email protected]> Reviewed-by: Vaibhav Agarwal <[email protected]> Signed-off-by: Wang Hai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/staging/greybus/audio_helper.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/greybus/audio_helper.c b/drivers/staging/greybus/audio_helper.c
index 237531ba60f3..3011b8abce38 100644
--- a/drivers/staging/greybus/audio_helper.c
+++ b/drivers/staging/greybus/audio_helper.c
@@ -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