From 2917c9e063b6a827b0757a8dd207d9c5bdc9d8c0 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Tue, 14 Jan 2020 21:49:07 -0500 Subject: [PATCH] fixes for 5.4 Signed-off-by: Sasha Levin --- ...d-hidraw-uhid-always-report-epollout.patch | 69 +++++++++++++++++++ queue-5.4/series | 1 + 2 files changed, 70 insertions(+) create mode 100644 queue-5.4/hid-hidraw-uhid-always-report-epollout.patch create mode 100644 queue-5.4/series diff --git a/queue-5.4/hid-hidraw-uhid-always-report-epollout.patch b/queue-5.4/hid-hidraw-uhid-always-report-epollout.patch new file mode 100644 index 00000000000..3a699550d4d --- /dev/null +++ b/queue-5.4/hid-hidraw-uhid-always-report-epollout.patch @@ -0,0 +1,69 @@ +From 8821fde511410c22d42fd2732a7d9ba8ac0eb4a8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Jan 2020 15:32:51 +0100 +Subject: HID: hidraw, uhid: Always report EPOLLOUT + +From: Jiri Kosina + +[ Upstream commit 9e635c2851df6caee651e589fbf937b637973c91 ] + +hidraw and uhid device nodes are always available for writing so we should +always report EPOLLOUT and EPOLLWRNORM bits, not only in the cases when +there is nothing to read. + +Reported-by: Linus Torvalds +Fixes: be54e7461ffdc ("HID: uhid: Fix returning EPOLLOUT from uhid_char_poll") +Fixes: 9f3b61dc1dd7b ("HID: hidraw: Fix returning EPOLLOUT from hidraw_poll") +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hidraw.c | 7 ++++--- + drivers/hid/uhid.c | 5 +++-- + 2 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c +index c25e95c19cad..b382c6bf2c5c 100644 +--- a/drivers/hid/hidraw.c ++++ b/drivers/hid/hidraw.c +@@ -249,13 +249,14 @@ out: + static __poll_t hidraw_poll(struct file *file, poll_table *wait) + { + struct hidraw_list *list = file->private_data; ++ __poll_t mask = EPOLLOUT | EPOLLWRNORM; /* hidraw is always writable */ + + poll_wait(file, &list->hidraw->wait, wait); + if (list->head != list->tail) +- return EPOLLIN | EPOLLRDNORM; ++ mask |= EPOLLIN | EPOLLRDNORM; + if (!list->hidraw->exist) +- return EPOLLERR | EPOLLHUP; +- return EPOLLOUT | EPOLLWRNORM; ++ mask |= EPOLLERR | EPOLLHUP; ++ return mask; + } + + static int hidraw_open(struct inode *inode, struct file *file) +diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c +index 935c3d0a3b63..8fe3efcb8327 100644 +--- a/drivers/hid/uhid.c ++++ b/drivers/hid/uhid.c +@@ -766,13 +766,14 @@ unlock: + static __poll_t uhid_char_poll(struct file *file, poll_table *wait) + { + struct uhid_device *uhid = file->private_data; ++ __poll_t mask = EPOLLOUT | EPOLLWRNORM; /* uhid is always writable */ + + poll_wait(file, &uhid->waitq, wait); + + if (uhid->head != uhid->tail) +- return EPOLLIN | EPOLLRDNORM; ++ mask |= EPOLLIN | EPOLLRDNORM; + +- return EPOLLOUT | EPOLLWRNORM; ++ return mask; + } + + static const struct file_operations uhid_fops = { +-- +2.20.1 + diff --git a/queue-5.4/series b/queue-5.4/series new file mode 100644 index 00000000000..6f146b4ed4e --- /dev/null +++ b/queue-5.4/series @@ -0,0 +1 @@ +hid-hidraw-uhid-always-report-epollout.patch -- 2.47.3