aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Vaga <federico.vaga@gmail.com>2011-10-29 09:47:39 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-26 18:34:15 -0800
commit6a9ce6b654e491981f6ef7e214cbd4f63e033848 (patch)
treeb1b2abec9775fc135d899b08351ac520a1197806
parentdf30b21cb0eed5ba8a8e0cdfeebc66ba8cde821d (diff)
Staging: comedi: fix signal handling in read and write
After sleeping on a wait queue, signal_pending(current) should be checked (not before sleeping). Acked-by: Alessandro Rubini <rubini@gnudd.com> Signed-off-by: Federico Vaga <federico.vaga@gmail.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/comedi/comedi_fops.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 88caa737699..ebdcecda358 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1673,11 +1673,11 @@ static ssize_t comedi_write(struct file *file, const char __user *buf,
retval = -EAGAIN;
break;
}
+ schedule();
if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
- schedule();
if (!s->busy)
break;
if (s->busy != file) {
@@ -1780,11 +1780,11 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
retval = -EAGAIN;
break;
}
+ schedule();
if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
- schedule();
if (!s->busy) {
retval = 0;
break;