diff mbox series

[11/12] ALSA: hdac: fix memory release for SST and SOF drivers

Message ID 20190518202704.7772-12-pierre-louis.bossart@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series ASoC: SOF: stability fixes | expand

Commit Message

Pierre-Louis Bossart May 18, 2019, 8:27 p.m. UTC
From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

During the integration of HDaudio support, we changed the way in which
we get hdev in snd_hdac_ext_bus_device_init() to use one preallocated
with devm_kzalloc(), however it still left kfree(hdev) in
snd_hdac_ext_bus_device_exit(). It leads to oopses when trying to
rmmod and modprobe. Fix it, by just removing kfree call.

SOF also uses some of the snd_hdac_ functions for HDAudio support but
allocated the memory with kzalloc. A matching fix is provided
separately to align all users of the snd_hdac_ library.

Fixes: 6298542fa33b ("ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init")
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/hda/ext/hdac_ext_bus.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Takashi Iwai May 19, 2019, 7:30 a.m. UTC | #1
On Sat, 18 May 2019 22:27:03 +0200,
Pierre-Louis Bossart wrote:
> 
> From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> 
> During the integration of HDaudio support, we changed the way in which
> we get hdev in snd_hdac_ext_bus_device_init() to use one preallocated
> with devm_kzalloc(), however it still left kfree(hdev) in
> snd_hdac_ext_bus_device_exit(). It leads to oopses when trying to
> rmmod and modprobe. Fix it, by just removing kfree call.
> 
> SOF also uses some of the snd_hdac_ functions for HDAudio support but
> allocated the memory with kzalloc. A matching fix is provided
> separately to align all users of the snd_hdac_ library.
> 
> Fixes: 6298542fa33b ("ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init")
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Since this is an individual fix from SOF, I'll take this one via my
tree.


thanks,

Takashi

> ---
>  sound/hda/ext/hdac_ext_bus.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
> index ec7715c6b0c0..c147ebe542da 100644
> --- a/sound/hda/ext/hdac_ext_bus.c
> +++ b/sound/hda/ext/hdac_ext_bus.c
> @@ -172,7 +172,6 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_init);
>  void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev)
>  {
>  	snd_hdac_device_exit(hdev);
> -	kfree(hdev);
>  }
>  EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit);
>  
> -- 
> 2.20.1
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Takashi Iwai May 19, 2019, 7:37 a.m. UTC | #2
On Sun, 19 May 2019 09:30:03 +0200,
Takashi Iwai wrote:
> 
> On Sat, 18 May 2019 22:27:03 +0200,
> Pierre-Louis Bossart wrote:
> > 
> > From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> > 
> > During the integration of HDaudio support, we changed the way in which
> > we get hdev in snd_hdac_ext_bus_device_init() to use one preallocated
> > with devm_kzalloc(), however it still left kfree(hdev) in
> > snd_hdac_ext_bus_device_exit(). It leads to oopses when trying to
> > rmmod and modprobe. Fix it, by just removing kfree call.
> > 
> > SOF also uses some of the snd_hdac_ functions for HDAudio support but
> > allocated the memory with kzalloc. A matching fix is provided
> > separately to align all users of the snd_hdac_ library.
> > 
> > Fixes: 6298542fa33b ("ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init")
> > Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> > Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> Since this is an individual fix from SOF, I'll take this one via my
> tree.

On the second thought: as the other two patches seem depending on this 
change as prerequisite, maybe better to leave this together with
others.  So, Mark feel free to take this with the series, but make
sure that they'll go to 5.2-rc.


thanks,

Takashi
diff mbox series

Patch

diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
index ec7715c6b0c0..c147ebe542da 100644
--- a/sound/hda/ext/hdac_ext_bus.c
+++ b/sound/hda/ext/hdac_ext_bus.c
@@ -172,7 +172,6 @@  EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_init);
 void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev)
 {
 	snd_hdac_device_exit(hdev);
-	kfree(hdev);
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit);