]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mei: amthif: discard not read messages
authorAlexander Usyskin <alexander.usyskin@intel.com>
Sun, 17 Apr 2016 16:16:04 +0000 (12:16 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Jun 2016 19:18:00 +0000 (12:18 -0700)
commit 9d04ee11db7bf0d848266cbfd7db336097a0e239 upstream.

When a message is received and amthif client is not in reading state
the message is ignored and left dangling in the queue. This may happen
after one of the amthif host connections is closed w/o completing the
reading. Another client will pick up a wrong message on next read
attempt which will lead to link reset.
To prevent this the driver has to properly discard the message when
amthif client is not in reading state.

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
drivers/misc/mei/interrupt.c
drivers/misc/mei/mei_dev.h

index 194360a5f7823331e1cff910edb31ea0e14514ba..a039a5df6f2147f3a86074ee50e7a73eeb5177f0 100644 (file)
@@ -380,8 +380,10 @@ int mei_amthif_irq_read_msg(struct mei_cl *cl,
 
        dev = cl->dev;
 
-       if (dev->iamthif_state != MEI_IAMTHIF_READING)
+       if (dev->iamthif_state != MEI_IAMTHIF_READING) {
+               mei_irq_discard_msg(dev, mei_hdr);
                return 0;
+       }
 
        ret = mei_cl_irq_read_msg(cl, mei_hdr, cmpl_list);
        if (ret)
index 704dc6caad6d783ac321d0ea9c7ccf881191bcb3..3831a7ba2531c2c32c164e8cd987ad8590ef99e4 100644 (file)
@@ -76,7 +76,6 @@ static inline int mei_cl_hbm_equal(struct mei_cl *cl,
  * @dev: mei device
  * @hdr: message header
  */
-static inline
 void mei_irq_discard_msg(struct mei_device *dev, struct mei_msg_hdr *hdr)
 {
        /*
index db78e6d994568e535902fa045a21c68091d4812f..859bdac2235203505e9eb3aff51dd2bce6fee93b 100644 (file)
@@ -704,6 +704,8 @@ bool mei_hbuf_acquire(struct mei_device *dev);
 
 bool mei_write_is_idle(struct mei_device *dev);
 
+void mei_irq_discard_msg(struct mei_device *dev, struct mei_msg_hdr *hdr);
+
 #if IS_ENABLED(CONFIG_DEBUG_FS)
 int mei_dbgfs_register(struct mei_device *dev, const char *name);
 void mei_dbgfs_deregister(struct mei_device *dev);