Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID fix from Jiri Kosina:
 "A regression fix for EPOLLOUT handling in hidraw and uhid"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  HID: hidraw, uhid: Always report EPOLLOUT
This commit is contained in:
Linus Torvalds 2020-01-10 13:41:16 -08:00
commit ac61145a72
2 changed files with 7 additions and 5 deletions

View file

@ -249,13 +249,14 @@ out:
static __poll_t hidraw_poll(struct file *file, poll_table *wait) static __poll_t hidraw_poll(struct file *file, poll_table *wait)
{ {
struct hidraw_list *list = file->private_data; struct hidraw_list *list = file->private_data;
__poll_t mask = EPOLLOUT | EPOLLWRNORM; /* hidraw is always writable */
poll_wait(file, &list->hidraw->wait, wait); poll_wait(file, &list->hidraw->wait, wait);
if (list->head != list->tail) if (list->head != list->tail)
return EPOLLIN | EPOLLRDNORM; mask |= EPOLLIN | EPOLLRDNORM;
if (!list->hidraw->exist) if (!list->hidraw->exist)
return EPOLLERR | EPOLLHUP; mask |= EPOLLERR | EPOLLHUP;
return EPOLLOUT | EPOLLWRNORM; return mask;
} }
static int hidraw_open(struct inode *inode, struct file *file) static int hidraw_open(struct inode *inode, struct file *file)

View file

@ -766,13 +766,14 @@ unlock:
static __poll_t uhid_char_poll(struct file *file, poll_table *wait) static __poll_t uhid_char_poll(struct file *file, poll_table *wait)
{ {
struct uhid_device *uhid = file->private_data; struct uhid_device *uhid = file->private_data;
__poll_t mask = EPOLLOUT | EPOLLWRNORM; /* uhid is always writable */
poll_wait(file, &uhid->waitq, wait); poll_wait(file, &uhid->waitq, wait);
if (uhid->head != uhid->tail) if (uhid->head != uhid->tail)
return EPOLLIN | EPOLLRDNORM; mask |= EPOLLIN | EPOLLRDNORM;
return EPOLLOUT | EPOLLWRNORM; return mask;
} }
static const struct file_operations uhid_fops = { static const struct file_operations uhid_fops = {