staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNING
authorIan Abbott <abbotti@mev.co.uk>
Fri, 28 Jul 2017 15:22:31 +0000 (16:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 30 Jul 2017 15:38:43 +0000 (08:38 -0700)
commitcef988642cdac44e910a27cb6e8166c96f86a0df
tree9d37e47ac1f93848411853aa531cb42c767cbbd9
parent055655a9f0fefef2256310a128a4cdaff8b8c432
staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNING

Comedi's read and write file operation handlers (`comedi_read()` and
`comedi_write()`) currently call `copy_to_user()` or `copy_from_user()`
whilst in the `TASK_INTERRUPTIBLE` state, which falls foul of the
`might_fault()` checks when enabled.  Fix it by setting the current task
state back to `TASK_RUNNING` a bit earlier before calling these
functions.

Reported-by: Piotr Gregor <piotrgregor@rsyncme.org>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 4.5+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c