[PATCH 4.4 08/28] HID: uhid: Fix returning EPOLLOUT from uhid_char_poll

From: Greg Kroah-Hartman
Date: Tue Jan 14 2020 - 05:12:48 EST


From: Marcel Holtmann <marcel@xxxxxxxxxxxx>

commit be54e7461ffdc5809b67d2aeefc1ddc9a91470c7 upstream.

Always return EPOLLOUT from uhid_char_poll to allow polling /dev/uhid
for writable state.

Fixes: 1f9dec1e0164 ("HID: uhid: allow poll()'ing on uhid devices")
Signed-off-by: Marcel Holtmann <marcel@xxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/hid/uhid.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -26,6 +26,7 @@
#include <linux/uhid.h>
#include <linux/wait.h>
#include <linux/uaccess.h>
+#include <linux/eventpoll.h>

#define UHID_NAME "uhid"
#define UHID_BUFSIZE 32
@@ -774,7 +775,7 @@ static unsigned int uhid_char_poll(struc
if (uhid->head != uhid->tail)
return POLLIN | POLLRDNORM;

- return 0;
+ return EPOLLOUT | EPOLLWRNORM;
}

static const struct file_operations uhid_fops = {