Commit 3c717a27 authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Sasha Levin

mei: ignore client writing state during cb completion

Ignore client writing state during cb completion to fix a memory
leak.

When moving cbs to the completion list we should not look at
writing_state as this state can be already overwritten by next
write, the fact that a cb is on the write waiting list means
that it was already written to the HW and we can safely complete it.

Same pays for wait in poll handler, we do not have to check the state
wake is done after completion list processing.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 34ec4366)
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 496eb81c
......@@ -906,8 +906,7 @@ static int mei_irq_thread_write_handler(struct mei_device *dev,
cl->status = 0;
list_del(&pos->list);
if (MEI_WRITING == cl->writing_state &&
pos->fop_type == MEI_FOP_WRITE &&
if (pos->fop_type == MEI_FOP_WRITE &&
cl != &dev->iamthif_cl) {
dev_dbg(&dev->pdev->dev, "MEI WRITE COMPLETE\n");
cl->writing_state = MEI_WRITE_COMPLETE;
......
......@@ -701,8 +701,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
mutex_unlock(&dev->device_lock);
poll_wait(file, &cl->tx_wait, wait);
mutex_lock(&dev->device_lock);
if (MEI_WRITE_COMPLETE == cl->writing_state)
mask |= (POLLIN | POLLRDNORM);
mask |= (POLLIN | POLLRDNORM);
out:
mutex_unlock(&dev->device_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment