linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: debug: fix error handling in hid_debug_events_read()
@ 2015-04-09 11:32 Jiri Kosina
  0 siblings, 0 replies; only message in thread
From: Jiri Kosina @ 2015-04-09 11:32 UTC (permalink / raw)
  To: linux-input; +Cc: jslaby, linux-kernel

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@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-04-09 11:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-09 11:32 [PATCH] HID: debug: fix error handling in hid_debug_events_read() Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).