]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: pcm: Fix double hw_free calls
authorTakashi Iwai <tiwai@suse.de>
Thu, 13 Feb 2020 06:03:49 +0000 (07:03 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 13 Feb 2020 15:30:22 +0000 (16:30 +0100)
commit38ecfec823f2ac35fcdc0586fbee32966de4742d
tree218dfdd93e79af7f7df2007ab99cf7106c6d6a3f
parentf4f33876185c47dc94e0713948c577b1a4b54b6d
ALSA: pcm: Fix double hw_free calls

The commit 0af359a704a6 ("ALSA: pcm: Fix memory leak at closing a
stream without hw_free") tried to fix the regression wrt the missing
hw_free call at closing without SNDRV_PCM_IOCTL_HW_FREE ioctl.
However, the code change dropped mistakenly the state check, resulting
in calling hw_free twice when SNDRV_PCM_IOCTL_HW_FRE got called
beforehand.  For most drivers, this is almost harmless, but the
drivers like SOF show another regression now.

This patch adds the state condition check before calling do_hw_free()
at releasing the stream for avoiding the double hw_free calls.

Fixes: 0af359a704a6 ("ALSA: pcm: Fix memory leak at closing a stream without hw_free")
Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/s5hd0ajyprg.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/pcm_native.c