All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: check for signals in chaoskey read function
@ 2016-02-16  2:49 Keith Packard
  2016-02-16  8:24 ` Oliver Neukum
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Packard @ 2016-02-16  2:49 UTC (permalink / raw)
  To: linux-usb; +Cc: Greg Kroah-Hartman, linux-kernel, Keith Packard

Call signal_pending before reading a chunk of data from the device so
that long read operations can be interrupted with a signal.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 drivers/usb/misc/chaoskey.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
index 23c7948..ab87db2 100644
--- a/drivers/usb/misc/chaoskey.c
+++ b/drivers/usb/misc/chaoskey.c
@@ -394,6 +394,13 @@ static ssize_t chaoskey_read(struct file *file,
 		if (result)
 			goto bail;
 		if (dev->valid == dev->used) {
+
+			if (signal_pending(current)) {
+				result = -ERESTARTSYS;
+				mutex_unlock(&dev->lock);
+				goto bail;
+			}
+
 			result = _chaoskey_fill(dev);
 			if (result) {
 				mutex_unlock(&dev->lock);
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-17 18:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-16  2:49 [PATCH] usb: check for signals in chaoskey read function Keith Packard
2016-02-16  8:24 ` Oliver Neukum
2016-02-16 19:09   ` Keith Packard
2016-02-17 14:59     ` Oliver Neukum
2016-02-17 18:05       ` Keith Packard
2016-02-17 18:21         ` Keith Packard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.