]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: pcm: Fix endless loop for XRUN recovery in OSS emulation
authorTakashi Iwai <tiwai@suse.de>
Sat, 7 Apr 2018 09:48:58 +0000 (11:48 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sat, 7 Apr 2018 11:10:11 +0000 (13:10 +0200)
commitd376fa032e64f642b2db95992d2afde0919ec579
treeb799a26d325c9cf18c19829c999b39ac8f7097ee
parentd9d8b2898214b3a0c31b6fcb32e92d3f7e05e2f3
ALSA: pcm: Fix endless loop for XRUN recovery in OSS emulation

The commit 4fac43d30a63 ("ALSA: pcm: Avoid potential races between OSS
ioctls and read/write") split the PCM preparation code to a locked
version, and it added a sanity check of runtime->oss.prepare flag
along with the change.  This leaded to an endless loop when the stream
gets XRUN: namely, snd_pcm_oss_write3() and co call
snd_pcm_oss_prepare() without setting runtime->oss.prepare flag and
the loop continues until the PCM state reaches to another one.

As the function is supposed to execute the preparation
unconditionally, drop the invalid state check there.

The bug was triggered by syzkaller.

Fixes: 4fac43d30a63 ("ALSA: pcm: Avoid potential races between OSS ioctls and read/write")
Reported-by: syzbot+150189c103427d31a053@syzkaller.appspotmail.com
Reported-by: syzbot+7e3f31a52646f939c052@syzkaller.appspotmail.com
Reported-by: syzbot+4f2016cf5185da7759dc@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/oss/pcm_oss.c