mei: wake blocked write on link reset
authorAlexander Usyskin <alexander.usyskin@intel.com>
Sun, 7 Feb 2016 21:35:34 +0000 (23:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 7 Feb 2016 22:47:20 +0000 (14:47 -0800)
In case of link reset all blocked writes should be interrupted.
Note, that currently blocking write is used only through bus layer.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/client.c

index 3fd070a..5ddc690 100644 (file)
@@ -1691,7 +1691,8 @@ out:
 
                mutex_unlock(&dev->device_lock);
                rets = wait_event_interruptible(cl->tx_wait,
 
                mutex_unlock(&dev->device_lock);
                rets = wait_event_interruptible(cl->tx_wait,
-                               cl->writing_state == MEI_WRITE_COMPLETE);
+                               cl->writing_state == MEI_WRITE_COMPLETE ||
+                               (!mei_cl_is_connected(cl)));
                mutex_lock(&dev->device_lock);
                /* wait_event_interruptible returns -ERESTARTSYS */
                if (rets) {
                mutex_lock(&dev->device_lock);
                /* wait_event_interruptible returns -ERESTARTSYS */
                if (rets) {
@@ -1699,6 +1700,10 @@ out:
                                rets = -EINTR;
                        goto err;
                }
                                rets = -EINTR;
                        goto err;
                }
+               if (cl->writing_state != MEI_WRITE_COMPLETE) {
+                       rets = -EFAULT;
+                       goto err;
+               }
        }
 
        rets = size;
        }
 
        rets = size;