]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.1/mei-amthif-discard-not-read-messages.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.1 / mei-amthif-discard-not-read-messages.patch
1 From 9d04ee11db7bf0d848266cbfd7db336097a0e239 Mon Sep 17 00:00:00 2001
2 From: Alexander Usyskin <alexander.usyskin@intel.com>
3 Date: Sun, 17 Apr 2016 12:16:04 -0400
4 Subject: mei: amthif: discard not read messages
5
6 From: Alexander Usyskin <alexander.usyskin@intel.com>
7
8 commit 9d04ee11db7bf0d848266cbfd7db336097a0e239 upstream.
9
10 When a message is received and amthif client is not in reading state
11 the message is ignored and left dangling in the queue. This may happen
12 after one of the amthif host connections is closed w/o completing the
13 reading. Another client will pick up a wrong message on next read
14 attempt which will lead to link reset.
15 To prevent this the driver has to properly discard the message when
16 amthif client is not in reading state.
17
18 Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
19 Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22 ---
23 drivers/misc/mei/amthif.c | 4 +++-
24 drivers/misc/mei/interrupt.c | 1 -
25 drivers/misc/mei/mei_dev.h | 2 ++
26 3 files changed, 5 insertions(+), 2 deletions(-)
27
28 --- a/drivers/misc/mei/amthif.c
29 +++ b/drivers/misc/mei/amthif.c
30 @@ -380,8 +380,10 @@ int mei_amthif_irq_read_msg(struct mei_c
31
32 dev = cl->dev;
33
34 - if (dev->iamthif_state != MEI_IAMTHIF_READING)
35 + if (dev->iamthif_state != MEI_IAMTHIF_READING) {
36 + mei_irq_discard_msg(dev, mei_hdr);
37 return 0;
38 + }
39
40 ret = mei_cl_irq_read_msg(cl, mei_hdr, cmpl_list);
41 if (ret)
42 --- a/drivers/misc/mei/interrupt.c
43 +++ b/drivers/misc/mei/interrupt.c
44 @@ -76,7 +76,6 @@ static inline int mei_cl_hbm_equal(struc
45 * @dev: mei device
46 * @hdr: message header
47 */
48 -static inline
49 void mei_irq_discard_msg(struct mei_device *dev, struct mei_msg_hdr *hdr)
50 {
51 /*
52 --- a/drivers/misc/mei/mei_dev.h
53 +++ b/drivers/misc/mei/mei_dev.h
54 @@ -704,6 +704,8 @@ bool mei_hbuf_acquire(struct mei_device
55
56 bool mei_write_is_idle(struct mei_device *dev);
57
58 +void mei_irq_discard_msg(struct mei_device *dev, struct mei_msg_hdr *hdr);
59 +
60 #if IS_ENABLED(CONFIG_DEBUG_FS)
61 int mei_dbgfs_register(struct mei_device *dev, const char *name);
62 void mei_dbgfs_deregister(struct mei_device *dev);