mei: amthif: interrupt reader on link reset
authorAlexander Usyskin <alexander.usyskin@intel.com>
Sun, 7 Feb 2016 21:35:29 +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 waiting readers should be interrupted.

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/amthif.c

index b98eac38978275f62aafe3d50dcd1ec1621890b2..ca2efc3602df261aa7a526f6f9d3ef46b4c3a4a9 100644 (file)
@@ -122,7 +122,8 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
                mutex_unlock(&dev->device_lock);
 
                wait_ret = wait_event_interruptible(cl->rx_wait,
-                                       !list_empty(&cl->rd_completed));
+                                       !list_empty(&cl->rd_completed) ||
+                                       !mei_cl_is_connected(cl));
 
                /* Locking again the Mutex */
                mutex_lock(&dev->device_lock);
@@ -130,6 +131,11 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
                if (wait_ret)
                        return -ERESTARTSYS;
 
+               if (!mei_cl_is_connected(cl)) {
+                       rets = -EBUSY;
+                       goto out;
+               }
+
                cb = mei_cl_read_cb(cl, file);
        }