Fix kernel deadlock in ppoll(2).

This commit is contained in:
Jonas 'Sortie' Termansen 2021-07-14 01:09:40 +02:00
parent 6bca83b399
commit 2d841bae7c
1 changed files with 2 additions and 2 deletions

View File

@ -249,8 +249,6 @@ int sys_ppoll(struct pollfd* user_fds, size_t nfds,
kthread_mutex_t wakeup_mutex = KTHREAD_MUTEX_INITIALIZER;
kthread_cond_t wakeup_cond = KTHREAD_COND_INITIALIZER;
kthread_mutex_lock(&wakeup_mutex);
int ret = -1;
bool self_woken = false;
bool remote_woken = false;
@ -305,6 +303,8 @@ int sys_ppoll(struct pollfd* user_fds, size_t nfds,
if ( timeout_ts.tv_sec == 0 && timeout_ts.tv_nsec == 0 )
self_woken = true;
kthread_mutex_lock(&wakeup_mutex);
while ( !(self_woken || remote_woken) )
{
if ( !kthread_cond_wait_signal(&wakeup_cond, &wakeup_mutex) )