From 549d8aed98c2de6326e6594a8cd020a84ff45726 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 1 Nov 2011 09:49:29 +0000 Subject: [PATCH] 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). --- comedi/comedi_fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.26.2