Skip to content

Commit

Permalink
Staging: comedi: fix signal handling in read and write
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
FedericoVaga authored and gregkh committed Nov 27, 2011
1 parent df30b21 commit 6a9ce6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6a9ce6b

Please sign in to comment.