patch "mei: remove support for broken parallel read" added to char-misc-next
Subsystems (3)
This is a note to let you know that I've just added the patch titled
mei: remove support for broken parallel read
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-next branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will also be merged in the next major kernel release during the merge window.
If you have any questions about this process, please let me know.
Quoted 1 line
From
cb97fbbcac15982406e0c74cd5512a8b6fcf10b3Mon Sep 17 00:00:00 2001
From: Alexander Usyskin <[email protected]>
Date: Wed, 8 Feb 2017 00:41:45 +0200
Subject: mei: remove support for broken parallel read
Parallel reads from multiple threads on a file descriptor are not well defined and racy. It is safer to return to original behavior and simply fail the additional read.
The solution is to remove request for next read credit.
--- drivers/misc/mei/main.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-)
drivers/misc/mei/main.c +26 -22
@@ -182,32 +182,36 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, goto out; } -if (rets == -EBUSY && - !mei_cl_enqueue_ctrl_wr_cb (cl, length,MEI_FOP_READ , file)) { - rets = -ENOMEM ; - goto out; - } -do { -mutex_unlock (&dev->device_lock); - -if (wait_event_interruptible (cl->rx_wait, - (!list_empty (&cl->rd_completed)) || - (!mei_cl_is_connected (cl)))) { +again: +mutex_unlock (&dev->device_lock); +if (wait_event_interruptible (cl->rx_wait, + !list_empty (&cl->rd_completed) || + !mei_cl_is_connected (cl))) { +if (signal_pending (current)) +return -EINTR ; +return -ERESTARTSYS ; + } +mutex_lock (&dev->device_lock); -if (signal_pending (current)) -return -EINTR ; -return -ERESTARTSYS ; - } +if (!mei_cl_is_connected (cl)) { + rets = -ENODEV ; + goto out; + } -mutex_lock (&dev->device_lock); -if (!mei_cl_is_connected (cl)) { - rets = -ENODEV ; - goto out; - } + cb =mei_cl_read_cb (cl, file); +if (!cb) { +/* +* For amthif all the waiters are woken up, +* but only fp with matching cb->fp get the cb, +* the others have to return to wait on read. +*/ +if (cl == &dev->iamthif_cl) + goto again; - cb =mei_cl_read_cb (cl, file); - }while (!cb); + rets =0 ; + goto out; + } copy_buffer:/* now copy the data to user space */
Signature · 1 line
2.11.1