linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dinghao Liu <dinghao.liu@zju.edu.cn>
Cc: kjlu@umn.edu, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>, Mark Hills <mark@xwax.org>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Takashi Sakamoto <o-takashi@sakamocchi.jp>,
	Giuliano Pochini <pochini@shiny.it>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: echoaudio: Fix memory leak in snd_echo_resume()
Date: Mon, 10 Aug 2020 08:54:15 +0200	[thread overview]
Message-ID: <s5h7du76lew.wl-tiwai@suse.de> (raw)
In-Reply-To: <20200810061500.9329-1-dinghao.liu@zju.edu.cn>

On Mon, 10 Aug 2020 08:14:58 +0200,
Dinghao Liu wrote:
> 
> When restore_dsp_rettings() fails, chip should be freed
> just like when init_hw() and request_irq() fails.
> 
> Fixes: 47b5d028fdce8 ("ALSA: Echoaudio - Add suspend support #2")
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>

Actually it's rather wrong to call snd_echo_free() in the resume error
path.  This may lead to an Oops at the next time the system goes to
resume.  That said, we should drop snd_echo_free() calls in other
error paths in snd_echo_resume() instead.


thanks,

Takashi


> ---
>  sound/pci/echoaudio/echoaudio.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
> index 6aeb99aa2414..2aa183fe5dc1 100644
> --- a/sound/pci/echoaudio/echoaudio.c
> +++ b/sound/pci/echoaudio/echoaudio.c
> @@ -2226,6 +2226,7 @@ static int snd_echo_resume(struct device *dev)
>  	chip->pipe_alloc_mask = pipe_alloc_mask;
>  	if (err < 0) {
>  		kfree(commpage_bak);
> +		snd_echo_free(chip);
>  		return err;
>  	}
>  
> -- 
> 2.17.1
> 

  reply	other threads:[~2020-08-10  6:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-10  6:14 [PATCH] ALSA: echoaudio: Fix memory leak in snd_echo_resume() Dinghao Liu
2020-08-10  6:54 ` Takashi Iwai [this message]
2020-08-13  6:44   ` dinghao.liu

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=s5h7du76lew.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=dan.carpenter@oracle.com \
    --cc=dinghao.liu@zju.edu.cn \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@xwax.org \
    --cc=o-takashi@sakamocchi.jp \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=pochini@shiny.it \
    --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;
as well as URLs for NNTP newsgroup(s).