mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 05:34:13 +08:00
ALSA: seq: oss: Don't drain at closing a client
The OSS sequencer client tries to drain the pending events at releasing. Unfortunately, as spotted by syzkaller fuzzer, this may lead to an unkillable process state when the event has been queued at the far future. Since the process being released can't be signaled any longer, it remains and waits for the echo-back event in that far future. Back to history, the draining feature was implemented at the time we misinterpreted POSIX definition for blocking file operation. Actually, such a behavior is superfluous at release, and we should just release the device as is instead of keeping it up forever. This patch just removes the draining call that may block the release for too long time unexpectedly. BugLink: http://lkml.kernel.org/r/CACT4Y+Y4kD-aBGj37rf-xBw9bH3GMU6P+MYg4W1e-s-paVD2pg@mail.gmail.com Reported-by: Dmitry Vyukov <dvyukov@google.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
17e2df4613
commit
197b958c1e
@ -149,8 +149,6 @@ odev_release(struct inode *inode, struct file *file)
|
|||||||
if ((dp = file->private_data) == NULL)
|
if ((dp = file->private_data) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
snd_seq_oss_drain_write(dp);
|
|
||||||
|
|
||||||
mutex_lock(®ister_mutex);
|
mutex_lock(®ister_mutex);
|
||||||
snd_seq_oss_release(dp);
|
snd_seq_oss_release(dp);
|
||||||
mutex_unlock(®ister_mutex);
|
mutex_unlock(®ister_mutex);
|
||||||
|
@ -127,7 +127,6 @@ int snd_seq_oss_write(struct seq_oss_devinfo *dp, const char __user *buf, int co
|
|||||||
unsigned int snd_seq_oss_poll(struct seq_oss_devinfo *dp, struct file *file, poll_table * wait);
|
unsigned int snd_seq_oss_poll(struct seq_oss_devinfo *dp, struct file *file, poll_table * wait);
|
||||||
|
|
||||||
void snd_seq_oss_reset(struct seq_oss_devinfo *dp);
|
void snd_seq_oss_reset(struct seq_oss_devinfo *dp);
|
||||||
void snd_seq_oss_drain_write(struct seq_oss_devinfo *dp);
|
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
void snd_seq_oss_process_queue(struct seq_oss_devinfo *dp, abstime_t time);
|
void snd_seq_oss_process_queue(struct seq_oss_devinfo *dp, abstime_t time);
|
||||||
|
@ -435,22 +435,6 @@ snd_seq_oss_release(struct seq_oss_devinfo *dp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wait until the queue is empty (if we don't have nonblock)
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
snd_seq_oss_drain_write(struct seq_oss_devinfo *dp)
|
|
||||||
{
|
|
||||||
if (! dp->timer->running)
|
|
||||||
return;
|
|
||||||
if (is_write_mode(dp->file_mode) && !is_nonblock_mode(dp->file_mode) &&
|
|
||||||
dp->writeq) {
|
|
||||||
while (snd_seq_oss_writeq_sync(dp->writeq))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* reset sequencer devices
|
* reset sequencer devices
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user