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 ...@@ -380,18 +380,21 @@ static ssize_t mousedev_read(struct file * file, char * buffer, size_t count, lo
if (!list->ready && !list->buffer) { if (!list->ready && !list->buffer) {
add_wait_queue(&list->mousedev->wait, &wait); add_wait_queue(&list->mousedev->wait, &wait);
set_current_state(TASK_INTERRUPTIBLE);
while (!list->ready) { for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
if (file->f_flags & O_NONBLOCK) { retval = 0;
retval = -EAGAIN; if (list->ready || list->buffer)
break; break;
}
if (signal_pending(current)) { retval = -EAGAIN;
retval = -ERESTARTSYS; if (file->f_flags & O_NONBLOCK)
break;
retval = -ERESTARTSYS;
if (signal_pending(current))
break; break;
}
schedule(); 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