* [PATCH] ALSA: echoaudio: Fix memory leak in snd_echo_resume()
@ 2020-08-10 6:14 Dinghao Liu
2020-08-10 6:54 ` Takashi Iwai
0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2020-08-10 6:14 UTC (permalink / raw)
To: dinghao.liu, kjlu
Cc: Jaroslav Kysela, Takashi Iwai, Mark Hills, Dan Carpenter,
Arnd Bergmann, Pierre-Louis Bossart, Takashi Sakamoto,
Giuliano Pochini, alsa-devel, linux-kernel
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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ALSA: echoaudio: Fix memory leak in snd_echo_resume()
2020-08-10 6:14 [PATCH] ALSA: echoaudio: Fix memory leak in snd_echo_resume() Dinghao Liu
@ 2020-08-10 6:54 ` Takashi Iwai
2020-08-13 6:44 ` dinghao.liu
0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2020-08-10 6:54 UTC (permalink / raw)
To: Dinghao Liu
Cc: kjlu, Jaroslav Kysela, Takashi Iwai, Mark Hills, Dan Carpenter,
Arnd Bergmann, Pierre-Louis Bossart, Takashi Sakamoto,
Giuliano Pochini, alsa-devel, linux-kernel
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [PATCH] ALSA: echoaudio: Fix memory leak in snd_echo_resume()
2020-08-10 6:54 ` Takashi Iwai
@ 2020-08-13 6:44 ` dinghao.liu
0 siblings, 0 replies; 3+ messages in thread
From: dinghao.liu @ 2020-08-13 6:44 UTC (permalink / raw)
To: Takashi Iwai
Cc: kjlu, Jaroslav Kysela, Takashi Iwai, Mark Hills, Dan Carpenter,
Arnd Bergmann, Pierre-Louis Bossart, Takashi Sakamoto,
Giuliano Pochini, alsa-devel, linux-kernel
> 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.
>
Thank you for your advice! I will send a new patch to fix this soon.
Regards,
Dinghao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-13 6:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 6:14 [PATCH] ALSA: echoaudio: Fix memory leak in snd_echo_resume() Dinghao Liu
2020-08-10 6:54 ` Takashi Iwai
2020-08-13 6:44 ` dinghao.liu
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).