From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
kernel-janitors@vger.kernel.org, Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget()
Date: Tue, 19 Feb 2019 09:59:07 -0600 [thread overview]
Message-ID: <d9db594e-7f29-b663-5920-aaab6e77d553@linux.intel.com> (raw)
In-Reply-To: <20190219120427.GA26719@kadam>
On 2/19/19 6:04 AM, Dan Carpenter wrote:
> We should free "w" on the error path.
>
> Fixes: 199ed3e81c49 ("ASoC: dapm: fix use-after-free issue with dailink sname")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Good catch, thanks.
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
> sound/soc/soc-dapm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index dea6fc2353e4..1ec06ef6d161 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -332,8 +332,10 @@ static inline struct snd_soc_dapm_widget *dapm_cnew_widget(
> */
> if (_widget->sname) {
> w->sname = kstrdup_const(_widget->sname, GFP_KERNEL);
> - if (!w->sname)
> + if (!w->sname) {
> + kfree(w);
> return NULL;
> + }
> }
> return w;
> }
prev parent reply other threads:[~2019-02-19 15:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 12:04 [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget() Dan Carpenter
2019-02-19 15:50 ` Applied "ASoC: dapm: Potential small memory leak in dapm_cnew_widget()" to the asoc tree Mark Brown
2019-02-19 15:59 ` Pierre-Louis Bossart [this message]
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=d9db594e-7f29-b663-5920-aaab6e77d553@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=tiwai@suse.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