]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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>
Wed, 16 Aug 2017 20:46:56 +0000 (13:46 -0700)
commitc208cb9a5596661a3fce7c5352bc9f1f4980f31d
tree978e45d04b4b6d81ab2b186f12ddfeb1649180b1
parent20035abc9e083387a3c163207f185468f5c137bb
staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNING

commit cef988642cdac44e910a27cb6e8166c96f86a0df upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c