From: Takashi Iwai <tiwai@suse.de>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: alsa-devel@alsa-project.org, broonie@kernel.org,
cezary.rojewski@intel.com, amadeuszx.slawinski@linux.intel.com
Subject: Re: [PATCH] ASoC: Intel: avs: fix possible memory leak in probe_codec()
Date: Wed, 02 Nov 2022 07:36:29 +0100 [thread overview]
Message-ID: <87k04d7thu.wl-tiwai@suse.de> (raw)
In-Reply-To: <9c364bc3-582d-c4ff-9aaf-deeddc30e57b@huawei.com>
On Wed, 02 Nov 2022 02:48:30 +0100,
Yang Yingliang wrote:
>
> +Cc: Takashi Iwai <tiwai@suse.de>
>
> Hi, is this patch good?
Not really. The codec instances are freed later at avs_pci_remove().
Takashi
>
> Thanks,
> Yang
> On 2022/10/22 10:58, Yang Yingliang wrote:
> > If snd_hda_codec_configure() fails, 'codec' and name allocated in
> > dev_set_name() called in snd_hdac_device_init() are leaked. Fix this
> > by calling snd_hdac_device_unregister() and put_device(), so they
> > can be freed in snd_hda_codec_dev_release() and kobject_cleanup().
> >
> > Fixes: 1affc44ea5dd ("ASoC: Intel: avs: PCI driver implementation")
> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> > ---
> > sound/soc/intel/avs/core.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c
> > index bb0719c58ca4..2fde2b3f8790 100644
> > --- a/sound/soc/intel/avs/core.c
> > +++ b/sound/soc/intel/avs/core.c
> > @@ -140,6 +140,8 @@ static int probe_codec(struct hdac_bus *bus, int addr)
> > ret = snd_hda_codec_configure(codec);
> > if (ret < 0) {
> > dev_err(bus->dev, "failed to config codec %d\n", ret);
> > + snd_hdac_device_unregister(&codec->core);
> > + put_device(&codec->core.dev);
> > return ret;
> > }
> >
>
prev parent reply other threads:[~2022-11-02 6:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-22 2:58 [PATCH] ASoC: Intel: avs: fix possible memory leak in probe_codec() Yang Yingliang
2022-11-02 1:48 ` Yang Yingliang
2022-11-02 6:36 ` Takashi Iwai [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=87k04d7thu.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=yangyingliang@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