Commit efae82c0 authored by Linus Torvalds's avatar Linus Torvalds

Avoid possibly busy-looping in mouse read.

parent c6e70088
......@@ -380,18 +380,21 @@ static ssize_t mousedev_read(struct file * file, char * buffer, size_t count, lo
if (!list->ready && !list->buffer) {
add_wait_queue(&list->mousedev->wait, &wait);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
while (!list->ready) {
retval = 0;
if (list->ready || list->buffer)
break;
if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN;
if (file->f_flags & O_NONBLOCK)
break;
}
if (signal_pending(current)) {
retval = -ERESTARTSYS;
if (signal_pending(current))
break;
}
schedule();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment