driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
From: Vaibhav Agarwal <vaibhav.sr@gmail.com>
To: Johan Hovold <johan@kernel.org>
Cc: devel@driverdev.osuosl.org, Wang Hai <wanghai38@huawei.com>,
	Alex Elder <elder@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	open list <linux-kernel@vger.kernel.org>,
	aibhav.sr@gmail.com,
	"moderated list:GREYBUS SUBSYSTEM" <greybus-dev@lists.linaro.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH] staging: greybus: audio: Add missing unlock in gbaudio_dapm_free_controls()
Date: Fri, 4 Dec 2020 23:32:47 +0530	[thread overview]
Message-ID: <CAAs3649kGerXZqgffwethn-JNOiiFSif1COM3no4Az4Ah220VA@mail.gmail.com> (raw)
In-Reply-To: <X8n2CL58pQ/077rQ@localhost>

On Fri, Dec 4, 2020 at 2:10 PM Johan Hovold <johan@kernel.org> wrote:
>
> On Fri, Dec 04, 2020 at 10:13:50AM +0800, Wang Hai wrote:
> > Add the missing unlock before return from function
> > gbaudio_dapm_free_controls() in the error handling case.
> >
> > 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 | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/staging/greybus/audio_helper.c b/drivers/staging/greybus/audio_helper.c
> > index 237531ba60f3..293675dbea10 100644
> > --- a/drivers/staging/greybus/audio_helper.c
> > +++ b/drivers/staging/greybus/audio_helper.c
> > @@ -135,6 +135,7 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm,
> >               if (!w) {
> >                       dev_err(dapm->dev, "%s: widget not found\n",
> >                               widget->name);
> > +                     mutex_unlock(&dapm->card->dapm_mutex);
> >                       return -EINVAL;
> >               }
> >               widget++;
>
> This superficially looks correct, but there seems to be another bug in
> this function. It can be used free an array of widgets, but if one of
> them isn't found we just leak the rest. Perhaps that return should
> rather be "widget++; continue;".
>
> Vaibhav?

Thanks Wang for sharing the patch. As already pointed by Johan, this
function indeed has another bug as well.
Pls feel free to share the patch as suggested above.

--
vaibhav

>
> Johan
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2020-12-04 18:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04  2:13 [PATCH] staging: greybus: audio: Add missing unlock in gbaudio_dapm_free_controls() Wang Hai
2020-12-04  8:40 ` Johan Hovold
2020-12-04  9:19   ` wanghai (M)
2020-12-04 10:40     ` Johan Hovold
2020-12-04 18:02   ` Vaibhav Agarwal [this message]
2020-12-05 10:44     ` wanghai (M)

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=CAAs3649kGerXZqgffwethn-JNOiiFSif1COM3no4Az4Ah220VA@mail.gmail.com \
    --to=vaibhav.sr@gmail.com \
    --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=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).