From: Federico Vaga Date: Sat, 29 Oct 2011 07:47:39 +0000 (+0200) Subject: Staging: comedi: fix signal handling in read and write X-Git-Tag: v2.6.32.50~14 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=117dabceadaac646d2e943ecb570920d4be2f521;p=karo-tx-linux.git Staging: comedi: fix signal handling in read and write commit 6a9ce6b654e491981f6ef7e214cbd4f63e033848 upstream. After sleeping on a wait queue, signal_pending(current) should be checked (not before sleeping). Acked-by: Alessandro Rubini Signed-off-by: Federico Vaga Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 7bd7436c50c9..908f25a51455 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1599,11 +1599,11 @@ static ssize_t comedi_write(struct file *file, const char *buf, size_t nbytes, retval = -EAGAIN; break; } + schedule(); if (signal_pending(current)) { retval = -ERESTARTSYS; break; } - schedule(); if (!s->busy) break; if (s->busy != file) { @@ -1706,11 +1706,11 @@ static ssize_t comedi_read(struct file *file, char *buf, size_t nbytes, retval = -EAGAIN; break; } + schedule(); if (signal_pending(current)) { retval = -ERESTARTSYS; break; } - schedule(); if (!s->busy) { retval = 0; break;