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);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
while (!list->ready) { retval = 0;
if (list->ready || list->buffer)
break;
if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN; retval = -EAGAIN;
if (file->f_flags & O_NONBLOCK)
break; break;
}
if (signal_pending(current)) {
retval = -ERESTARTSYS; 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