All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: cs35l41: fix double free on error in probe()
@ 2022-01-11  7:22 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-01-11  7:22 UTC (permalink / raw)
  To: James Schulman, Lucas Tanure
  Cc: David Rhodes, Jaroslav Kysela, Takashi Iwai, alsa-devel, patches,
	kernel-janitors

If we encounter an error after the kfree(acpi_hw_cfg); then the goto
err; will result in a double free.

Fixes: 7b2f3eb492da ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 sound/pci/hda/cs35l41_hda.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
index aa5bb6977792..30b40d865863 100644
--- a/sound/pci/hda/cs35l41_hda.c
+++ b/sound/pci/hda/cs35l41_hda.c
@@ -477,6 +477,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
 	if (ret)
 		goto err;
 	kfree(acpi_hw_cfg);
+	acpi_hw_cfg = NULL;
 
 	if (cs35l41->reg_seq->probe) {
 		ret = regmap_register_patch(cs35l41->regmap, cs35l41->reg_seq->probe,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ALSA: hda: cs35l41: fix double free on error in probe()
@ 2022-01-11  7:22 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-01-11  7:22 UTC (permalink / raw)
  To: James Schulman, Lucas Tanure
  Cc: alsa-devel, patches, kernel-janitors, Takashi Iwai, David Rhodes

If we encounter an error after the kfree(acpi_hw_cfg); then the goto
err; will result in a double free.

Fixes: 7b2f3eb492da ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 sound/pci/hda/cs35l41_hda.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
index aa5bb6977792..30b40d865863 100644
--- a/sound/pci/hda/cs35l41_hda.c
+++ b/sound/pci/hda/cs35l41_hda.c
@@ -477,6 +477,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
 	if (ret)
 		goto err;
 	kfree(acpi_hw_cfg);
+	acpi_hw_cfg = NULL;
 
 	if (cs35l41->reg_seq->probe) {
 		ret = regmap_register_patch(cs35l41->regmap, cs35l41->reg_seq->probe,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: hda: cs35l41: fix double free on error in probe()
  2022-01-11  7:22 ` Dan Carpenter
@ 2022-01-11 16:09   ` Takashi Iwai
  -1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2022-01-11 16:09 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: James Schulman, Lucas Tanure, David Rhodes, Jaroslav Kysela,
	Takashi Iwai, alsa-devel, patches, kernel-janitors

On Tue, 11 Jan 2022 08:22:32 +0100,
Dan Carpenter wrote:
> 
> If we encounter an error after the kfree(acpi_hw_cfg); then the goto
> err; will result in a double free.
> 
> Fixes: 7b2f3eb492da ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied now.


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: hda: cs35l41: fix double free on error in probe()
@ 2022-01-11 16:09   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2022-01-11 16:09 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: alsa-devel, Lucas Tanure, patches, kernel-janitors, Takashi Iwai,
	James Schulman, David Rhodes

On Tue, 11 Jan 2022 08:22:32 +0100,
Dan Carpenter wrote:
> 
> If we encounter an error after the kfree(acpi_hw_cfg); then the goto
> err; will result in a double free.
> 
> Fixes: 7b2f3eb492da ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied now.


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-11 16:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11  7:22 [PATCH] ALSA: hda: cs35l41: fix double free on error in probe() Dan Carpenter
2022-01-11  7:22 ` Dan Carpenter
2022-01-11 16:09 ` Takashi Iwai
2022-01-11 16:09   ` 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.