From: Johan Hovold <johan@kernel.org>
To: Wang Hai <wanghai38@huawei.com>
Cc: johan@kernel.org, vaibhav.sr@gmail.com, elder@kernel.org,
gregkh@linuxfoundation.org, dan.carpenter@oracle.com,
aibhav.sr@gmail.com, greybus-dev@lists.linaro.org,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: greybus: audio: Fix possible leak free widgets in gbaudio_dapm_free_controls
Date: Tue, 8 Dec 2020 10:35:02 +0100 [thread overview]
Message-ID: <X89IxvbYWjuyaQDT@localhost> (raw)
In-Reply-To: <20201205103827.31244-1-wanghai38@huawei.com>
On Sat, Dec 05, 2020 at 06:38:27PM +0800, Wang Hai wrote:
> 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.
Apart from the typo, please break your lines at 72 columns or so (not
needed for the Fixes tag).
> Fixes: 510e340efe0c ("staging: greybus: audio: Add helper APIs for dynamic audio module")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>
> ---
> drivers/staging/greybus/audio_helper.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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
Not sure if we can ever have the widget lookup fail, but at least this
looks consistent now.
Reviewed-by: Johan Hovold <johan@kernel.org>
Johan
next prev parent reply other threads:[~2020-12-08 9:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-05 10:38 [PATCH] staging: greybus: audio: Fix possible leak free widgets in gbaudio_dapm_free_controls Wang Hai
2020-12-05 14:46 ` Vaibhav Agarwal
2020-12-08 9:35 ` Johan Hovold [this message]
[not found] ` <ed57715b-c524-4726-3eaf-434af96d2d92@huawei.com>
2020-12-14 9:48 ` Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=X89IxvbYWjuyaQDT@localhost \
--to=johan@kernel.org \
--cc=aibhav.sr@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vaibhav.sr@gmail.com \
--cc=wanghai38@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox