diff --git a/fs/select.c b/fs/select.c index 7da531b1cf6b..63dd2fb58447 100644 --- a/fs/select.c +++ b/fs/select.c @@ -977,6 +977,7 @@ static int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, struct poll_list *walk = head; unsigned int todo = nfds; unsigned int len; + static DEFINE_MUTEX(syspoll_lock); if (nfds > rlimit(RLIMIT_NOFILE)) return -EINVAL; @@ -1005,9 +1006,11 @@ static int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, } } + mutex_lock(&syspoll_lock); poll_initwait(&table); fdcount = do_poll(head, &table, end_time); poll_freewait(&table); + mutex_unlock(&syspoll_lock); if (!user_write_access_begin(ufds, nfds * sizeof(*ufds))) goto out_fds;