Skip to content

Commit

Permalink
Input: uinput - always report EPOLLOUT
Browse files Browse the repository at this point in the history
uinput device is always available for writing so we should always report
EPOLLOUT and EPOLLWRNORM bits, not only when there is nothing to read from
the device.

Fixes: d4b675e ("Input: uinput - fix returning EPOLLOUT from uinput_poll")
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20191209202254.GA107567@dtor-ws
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Dmitry Torokhov committed Dec 13, 2019
1 parent afbd65f commit add2180
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/input/misc/uinput.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,13 +689,14 @@ static ssize_t uinput_read(struct file *file, char __user *buffer,
static __poll_t uinput_poll(struct file *file, poll_table *wait)
{
struct uinput_device *udev = file->private_data;
__poll_t mask = EPOLLOUT | EPOLLWRNORM; /* uinput is always writable */

poll_wait(file, &udev->waitq, wait);

if (udev->head != udev->tail)
return EPOLLIN | EPOLLRDNORM;
mask |= EPOLLIN | EPOLLRDNORM;

return EPOLLOUT | EPOLLWRNORM;
return mask;
}

static int uinput_release(struct inode *inode, struct file *file)
Expand Down

0 comments on commit add2180

Please sign in to comment.