From: Ian Abbott Date: Tue, 1 Nov 2011 09:49:29 +0000 (+0000) Subject: Fix signal handling in read and write X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=549d8aed98c2de6326e6594a8cd020a84ff45726;p=comedi.git Fix signal handling in read and write Follow bug-fix by Federico Vaga on the Linux "staging" version: After sleeping on a wait queue, signal_pending(current) should be checked (not before sleeping). --- diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index 0b29573b..210eb416 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -1682,11 +1682,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; } @@ -1784,11 +1784,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;