提交 29159a4e 编写于 作者: T Takashi Iwai

ALSA: pcm: Abort properly at pending signal in OSS read/write loops

The loops for read and write in PCM OSS emulation have no proper check
of pending signals, and they keep processing even after user tries to
break.  This results in a very long delay, often seen as RCU stall
when a huge unprocessed bytes remain queued.  The bug could be easily
triggered by syzkaller.

As a simple workaround, this patch adds the proper check of pending
signals and aborts the loop appropriately.

Reported-by: syzbot+993cb4cfcbbff3947c21@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 898dfe46
...@@ -1381,6 +1381,10 @@ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const cha ...@@ -1381,6 +1381,10 @@ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const cha
tmp != runtime->oss.period_bytes) tmp != runtime->oss.period_bytes)
break; break;
} }
if (signal_pending(current)) {
tmp = -ERESTARTSYS;
goto err;
}
} }
mutex_unlock(&runtime->oss.params_lock); mutex_unlock(&runtime->oss.params_lock);
return xfer; return xfer;
...@@ -1466,6 +1470,10 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use ...@@ -1466,6 +1470,10 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
bytes -= tmp; bytes -= tmp;
xfer += tmp; xfer += tmp;
} }
if (signal_pending(current)) {
tmp = -ERESTARTSYS;
goto err;
}
} }
mutex_unlock(&runtime->oss.params_lock); mutex_unlock(&runtime->oss.params_lock);
return xfer; return xfer;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册