]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mei: ignore client writing state during cb completion
authorAlexander Usyskin <alexander.usyskin@intel.com>
Tue, 1 Apr 2014 20:50:41 +0000 (23:50 +0300)
committerJiri Slaby <jslaby@suse.cz>
Thu, 15 May 2014 07:54:52 +0000 (09:54 +0200)
commit 34ec43661fe8f1977dd0f05353302ae2ed10aabb upstream.

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.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/misc/mei/interrupt.c
drivers/misc/mei/main.c

index 1b922e971d3eb347121dfe3b70865bb28c898380..41b4b4818b04dcc6309238d99f1e161ab6d5d5b2 100644 (file)
@@ -420,8 +420,7 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
 
                cl->status = 0;
                list_del(&cb->list);
-               if (MEI_WRITING == cl->writing_state &&
-                   cb->fop_type == MEI_FOP_WRITE &&
+               if (cb->fop_type == MEI_FOP_WRITE &&
                    cl != &dev->iamthif_cl) {
                        dev_dbg(&dev->pdev->dev, "MEI WRITE COMPLETE\n");
                        cl->writing_state = MEI_WRITE_COMPLETE;
index cabeddd66c1f406f73f7e5bed2a56b7e52cd7621..9558bef37eea673973efec1d1885af803f2f959d 100644 (file)
@@ -648,8 +648,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
                goto out;
        }
 
-       if (MEI_WRITE_COMPLETE == cl->writing_state)
-               mask |= (POLLIN | POLLRDNORM);
+       mask |= (POLLIN | POLLRDNORM);
 
 out:
        mutex_unlock(&dev->device_lock);