* [PATCH] ALSA: lx6464es: Fix memory leaks in snd_lx6464es_create
@ 2019-10-27 19:24 ` Navid Emamdoost
0 siblings, 0 replies; 7+ messages in thread
From: Navid Emamdoost @ 2019-10-27 19:24 UTC (permalink / raw)
Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Jaroslav Kysela,
Takashi Iwai, Thomas Gleixner, Allison Randal, Tim Blechmann,
Hariprasad Kelam, alsa-devel, linux-kernel
In the implementation of snd_lx6464es_create() it there are memory leaks
when error happens. Go to error path if any of these calls fail:
lx_init_dsp(), lx_pcm_create(), lx_proc_create(), snd_ctl_add().
Fixes: 02bec4904508 ("ALSA: lx6464es - driver for the digigram lx6464es interface")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
sound/pci/lx6464es/lx6464es.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index fe10714380f2..7c6e8f4ef826 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -1020,25 +1020,26 @@ static int snd_lx6464es_create(struct snd_card *card,
err = lx_init_dsp(chip);
if (err < 0) {
dev_err(card->dev, "error during DSP initialization\n");
- return err;
+ goto cleanup;
}
err = lx_pcm_create(chip);
if (err < 0)
- return err;
+ goto cleanup;
err = lx_proc_create(card, chip);
if (err < 0)
- return err;
+ goto cleanup;
err = snd_ctl_add(card, snd_ctl_new1(&lx_control_playback_switch,
chip));
if (err < 0)
- return err;
+ goto cleanup;
*rchip = chip;
return 0;
+cleanup:
device_new_failed:
free_irq(pci->irq, chip);
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [alsa-devel] [PATCH] ALSA: lx6464es: Fix memory leaks in snd_lx6464es_create
@ 2019-10-27 19:24 ` Navid Emamdoost
0 siblings, 0 replies; 7+ messages in thread
From: Navid Emamdoost @ 2019-10-27 19:24 UTC (permalink / raw)
Cc: Hariprasad Kelam, alsa-devel, linux-kernel, kjlu, Takashi Iwai,
emamd001, smccaman, Tim Blechmann, Thomas Gleixner,
Allison Randal, Navid Emamdoost
In the implementation of snd_lx6464es_create() it there are memory leaks
when error happens. Go to error path if any of these calls fail:
lx_init_dsp(), lx_pcm_create(), lx_proc_create(), snd_ctl_add().
Fixes: 02bec4904508 ("ALSA: lx6464es - driver for the digigram lx6464es interface")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
sound/pci/lx6464es/lx6464es.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index fe10714380f2..7c6e8f4ef826 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -1020,25 +1020,26 @@ static int snd_lx6464es_create(struct snd_card *card,
err = lx_init_dsp(chip);
if (err < 0) {
dev_err(card->dev, "error during DSP initialization\n");
- return err;
+ goto cleanup;
}
err = lx_pcm_create(chip);
if (err < 0)
- return err;
+ goto cleanup;
err = lx_proc_create(card, chip);
if (err < 0)
- return err;
+ goto cleanup;
err = snd_ctl_add(card, snd_ctl_new1(&lx_control_playback_switch,
chip));
if (err < 0)
- return err;
+ goto cleanup;
*rchip = chip;
return 0;
+cleanup:
device_new_failed:
free_irq(pci->irq, chip);
--
2.17.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ALSA: lx6464es: Fix memory leaks in snd_lx6464es_create
2019-10-27 19:24 ` [alsa-devel] " Navid Emamdoost
(?)
@ 2019-10-27 21:10 ` Markus Elfring
-1 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2019-10-27 21:10 UTC (permalink / raw)
To: Navid Emamdoost, alsa-devel
Cc: Navid Emamdoost, Kangjie Lu, Stephen McCamant, Allison Randal,
Hariprasad Kelam, Jaroslav Kysela, Takashi Iwai, Thomas Gleixner,
Tim Blechmann, kernel-janitors, LKML
> In the implementation of snd_lx6464es_create() it there are memory leaks
> when error happens. Go to error path if any of these calls fail:
Please improve the wording for such a change description.
Regards,
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ALSA: lx6464es: Fix memory leaks in snd_lx6464es_create
@ 2019-10-27 21:10 ` Markus Elfring
0 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2019-10-27 21:10 UTC (permalink / raw)
To: Navid Emamdoost, alsa-devel
Cc: Hariprasad Kelam, LKML, kernel-janitors, Kangjie Lu,
Takashi Iwai, Navid Emamdoost, Stephen McCamant, Tim Blechmann,
Thomas Gleixner, Allison Randal
> In the implementation of snd_lx6464es_create() it there are memory leaks
> when error happens. Go to error path if any of these calls fail:
Please improve the wording for such a change description.
Regards,
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [alsa-devel] [PATCH] ALSA: lx6464es: Fix memory leaks in snd_lx6464es_create
@ 2019-10-27 21:10 ` Markus Elfring
0 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2019-10-27 21:10 UTC (permalink / raw)
To: Navid Emamdoost, alsa-devel
Cc: Hariprasad Kelam, LKML, kernel-janitors, Kangjie Lu,
Takashi Iwai, Navid Emamdoost, Stephen McCamant, Tim Blechmann,
Thomas Gleixner, Allison Randal
> In the implementation of snd_lx6464es_create() it there are memory leaks
> when error happens. Go to error path if any of these calls fail:
Please improve the wording for such a change description.
Regards,
Markus
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ALSA: lx6464es: Fix memory leaks in snd_lx6464es_create
2019-10-27 19:24 ` [alsa-devel] " Navid Emamdoost
@ 2019-10-28 6:30 ` Takashi Iwai
-1 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2019-10-28 6:30 UTC (permalink / raw)
To: Navid Emamdoost
Cc: emamd001, kjlu, smccaman, Jaroslav Kysela, Takashi Iwai,
Thomas Gleixner, Allison Randal, Tim Blechmann, Hariprasad Kelam,
alsa-devel, linux-kernel
On Sun, 27 Oct 2019 20:24:13 +0100,
Navid Emamdoost wrote:
>
> In the implementation of snd_lx6464es_create() it there are memory leaks
> when error happens. Go to error path if any of these calls fail:
> lx_init_dsp(), lx_pcm_create(), lx_proc_create(), snd_ctl_add().
Again no for this patch, it'll lead to double-frees.
After registered via snd_device_new(), the device object gets released
by its callback and the single snd_card_free() call suffices.
thanks,
Takashi
>
> Fixes: 02bec4904508 ("ALSA: lx6464es - driver for the digigram lx6464es interface")
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
> sound/pci/lx6464es/lx6464es.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
> index fe10714380f2..7c6e8f4ef826 100644
> --- a/sound/pci/lx6464es/lx6464es.c
> +++ b/sound/pci/lx6464es/lx6464es.c
> @@ -1020,25 +1020,26 @@ static int snd_lx6464es_create(struct snd_card *card,
> err = lx_init_dsp(chip);
> if (err < 0) {
> dev_err(card->dev, "error during DSP initialization\n");
> - return err;
> + goto cleanup;
> }
>
> err = lx_pcm_create(chip);
> if (err < 0)
> - return err;
> + goto cleanup;
>
> err = lx_proc_create(card, chip);
> if (err < 0)
> - return err;
> + goto cleanup;
>
> err = snd_ctl_add(card, snd_ctl_new1(&lx_control_playback_switch,
> chip));
> if (err < 0)
> - return err;
> + goto cleanup;
>
> *rchip = chip;
> return 0;
>
> +cleanup:
> device_new_failed:
> free_irq(pci->irq, chip);
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [alsa-devel] [PATCH] ALSA: lx6464es: Fix memory leaks in snd_lx6464es_create
@ 2019-10-28 6:30 ` Takashi Iwai
0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2019-10-28 6:30 UTC (permalink / raw)
To: Navid Emamdoost
Cc: Hariprasad Kelam, alsa-devel, linux-kernel, kjlu, Takashi Iwai,
emamd001, smccaman, Tim Blechmann, Thomas Gleixner,
Allison Randal
On Sun, 27 Oct 2019 20:24:13 +0100,
Navid Emamdoost wrote:
>
> In the implementation of snd_lx6464es_create() it there are memory leaks
> when error happens. Go to error path if any of these calls fail:
> lx_init_dsp(), lx_pcm_create(), lx_proc_create(), snd_ctl_add().
Again no for this patch, it'll lead to double-frees.
After registered via snd_device_new(), the device object gets released
by its callback and the single snd_card_free() call suffices.
thanks,
Takashi
>
> Fixes: 02bec4904508 ("ALSA: lx6464es - driver for the digigram lx6464es interface")
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
> sound/pci/lx6464es/lx6464es.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
> index fe10714380f2..7c6e8f4ef826 100644
> --- a/sound/pci/lx6464es/lx6464es.c
> +++ b/sound/pci/lx6464es/lx6464es.c
> @@ -1020,25 +1020,26 @@ static int snd_lx6464es_create(struct snd_card *card,
> err = lx_init_dsp(chip);
> if (err < 0) {
> dev_err(card->dev, "error during DSP initialization\n");
> - return err;
> + goto cleanup;
> }
>
> err = lx_pcm_create(chip);
> if (err < 0)
> - return err;
> + goto cleanup;
>
> err = lx_proc_create(card, chip);
> if (err < 0)
> - return err;
> + goto cleanup;
>
> err = snd_ctl_add(card, snd_ctl_new1(&lx_control_playback_switch,
> chip));
> if (err < 0)
> - return err;
> + goto cleanup;
>
> *rchip = chip;
> return 0;
>
> +cleanup:
> device_new_failed:
> free_irq(pci->irq, chip);
>
> --
> 2.17.1
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-10-28 7:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-27 19:24 [PATCH] ALSA: lx6464es: Fix memory leaks in snd_lx6464es_create Navid Emamdoost
2019-10-27 19:24 ` [alsa-devel] " Navid Emamdoost
2019-10-27 21:10 ` Markus Elfring
2019-10-27 21:10 ` [alsa-devel] " Markus Elfring
2019-10-27 21:10 ` Markus Elfring
2019-10-28 6:30 ` Takashi Iwai
2019-10-28 6:30 ` [alsa-devel] " Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.