staging: greybus: audio: Fix possible leak free widgets in gbaudio_dapm_free_controls
authorWang Hai <wanghai38@huawei.com>
Sat, 5 Dec 2020 10:38:27 +0000 (18:38 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:53:39 +0000 (11:53 +0100)
commitf636755d7fe51fc908c5329bc90486d1c9c5d561
tree83fce388fac196212e257be12f5ef5ee860ae00d
parentb4db71c2d7af0b4ce06d3036444e303bd4a501ad
staging: greybus: audio: Fix possible leak free widgets in gbaudio_dapm_free_controls

[ Upstream commit e77b259f67ab99f1e22ce895b9b1c637fd5f2d4c ]

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 <hulkci@huawei.com>
Reviewed-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Link: https://lore.kernel.org/r/20201205103827.31244-1-wanghai38@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/greybus/audio_helper.c