ALSA: pcm: Fix stream lock usage in snd_pcm_period_elapsed()
authorpaulhsia <paulhsia@chromium.org>
Tue, 12 Nov 2019 17:17:14 +0000 (01:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Dec 2019 09:40:49 +0000 (10:40 +0100)
commit4bec1e750fc20611d7ffc7e4b110c0057465ceb4
treec74455c64c68e3217109b04dba5019aca601125e
parentad4784e67c8969d214da6ae2d2e6a3790178d50e
ALSA: pcm: Fix stream lock usage in snd_pcm_period_elapsed()

[ Upstream commit f5cdc9d4003a2f66ea57b3edd3e04acc2b1a4439 ]

If the nullity check for `substream->runtime` is outside of the lock
region, it is possible to have a null runtime in the critical section
if snd_pcm_detach_substream is called right before the lock.

Signed-off-by: paulhsia <paulhsia@chromium.org>
Link: https://lore.kernel.org/r/20191112171715.128727-2-paulhsia@chromium.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/core/pcm_lib.c