Patch "staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNING" has been added to the 4.12-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNING
to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
staging-comedi-comedi_fops-do-not-call-blocking-ops-when-task_running.patch
and it can be found in the queue-4.12 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
cef988642cdac44e910a27cb6e8166c96f86a0dfMon Sep 17 00:00:00 2001
From: Ian Abbott <[email protected]>
Date: Fri, 28 Jul 2017 16:22:31 +0100
Subject: staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNING
From: Ian Abbott <[email protected]>
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.
--- drivers/staging/comedi/comedi_fops.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/comedi/comedi_fops.c +3 -0
@@ -2396,6 +2396,7 @@ static ssize_t comedi_write(struct filecontinue ; } +set_current_state (TASK_RUNNING ); wp = async->buf_write_ptr; n1 =min (n, async->prealloc_bufsz - wp); n2 = n - n1;
@@ -2528,6 +2529,8 @@ static ssize_t comedi_read(struct file * }continue ; } + +set_current_state (TASK_RUNNING ); rp = async->buf_read_ptr; n1 =min (n, async->prealloc_bufsz - rp); n2 = n - n1;
Patches currently in stable-queue which might be from [email protected] are
queue-4.12/staging-comedi-comedi_fops-do-not-call-blocking-ops-when-task_running.patch