[<prev] [next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1504091331420.10724@pobox.suse.cz>
Date: Thu, 9 Apr 2015 13:32:35 +0200 (CEST)
From: Jiri Kosina <jkosina@...e.cz>
To: linux-input@...r.kernel.org
cc: jslaby@...e.cz, linux-kernel@...r.kernel.org
Subject: [PATCH] HID: debug: fix error handling in hid_debug_events_read()
In the unlikely case of hdev vanishing while hid_debug_events_read() was
sleeping, we can really break out of the case switch as with other cases,
as on the way out we'll try to remove ourselves from the hdev waitqueue.
Fix this by taking a shortcut exit path and avoiding cleanup that doesn't
make sense in case hdev doesn't exist any more anyway.
Reported-by: Jiri Slaby <jslaby@...e.cz>
Signed-off-by: Jiri Kosina <jkosina@...e.cz>
---
drivers/hid/hid-debug.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 8bf61d2..f5021fb 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -1127,7 +1127,8 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,
if (!list->hdev || !list->hdev->debug) {
ret = -EIO;
- break;
+ set_current_state(TASK_RUNNING);
+ goto out;
}
/* allow O_NONBLOCK from other threads */
--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists