diff options
author | Alexander Usyskin <alexander.usyskin@intel.com> | 2016-02-07 16:35:36 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-07 17:47:20 -0500 |
commit | 603c53e42adf5f2d29ffdd1ff1edda0c27e400df (patch) | |
tree | 0850fff05f3e143de2b97e9c59749d78066a1937 | |
parent | a4307fe45aa9be03d5d7194b317a40b0d0558bee (diff) |
mei: discard replies from unconnected fixed address clients
A fixed address client in the FW doesn't have a notion of connection and
can send message after the file associated with it was already closed.
Silently discard such messages.
Add inline helpers to detect whether a message is hbm or intended for
a fixed address client
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>
-rw-r--r-- | drivers/misc/mei/interrupt.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c index 72806ef6efdd..06b744a503a3 100644 --- a/drivers/misc/mei/interrupt.c +++ b/drivers/misc/mei/interrupt.c | |||
@@ -239,6 +239,16 @@ static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb, | |||
239 | return 0; | 239 | return 0; |
240 | } | 240 | } |
241 | 241 | ||
242 | static inline bool hdr_is_hbm(struct mei_msg_hdr *mei_hdr) | ||
243 | { | ||
244 | return mei_hdr->host_addr == 0 && mei_hdr->me_addr == 0; | ||
245 | } | ||
246 | |||
247 | static inline bool hdr_is_fixed(struct mei_msg_hdr *mei_hdr) | ||
248 | { | ||
249 | return mei_hdr->host_addr == 0 && mei_hdr->me_addr != 0; | ||
250 | } | ||
251 | |||
242 | /** | 252 | /** |
243 | * mei_irq_read_handler - bottom half read routine after ISR to | 253 | * mei_irq_read_handler - bottom half read routine after ISR to |
244 | * handle the read processing. | 254 | * handle the read processing. |
@@ -280,7 +290,7 @@ int mei_irq_read_handler(struct mei_device *dev, | |||
280 | } | 290 | } |
281 | 291 | ||
282 | /* HBM message */ | 292 | /* HBM message */ |
283 | if (mei_hdr->host_addr == 0 && mei_hdr->me_addr == 0) { | 293 | if (hdr_is_hbm(mei_hdr)) { |
284 | ret = mei_hbm_dispatch(dev, mei_hdr); | 294 | ret = mei_hbm_dispatch(dev, mei_hdr); |
285 | if (ret) { | 295 | if (ret) { |
286 | dev_dbg(dev->dev, "mei_hbm_dispatch failed ret = %d\n", | 296 | dev_dbg(dev->dev, "mei_hbm_dispatch failed ret = %d\n", |
@@ -300,6 +310,14 @@ int mei_irq_read_handler(struct mei_device *dev, | |||
300 | 310 | ||
301 | /* if no recipient cl was found we assume corrupted header */ | 311 | /* if no recipient cl was found we assume corrupted header */ |
302 | if (&cl->link == &dev->file_list) { | 312 | if (&cl->link == &dev->file_list) { |
313 | /* A message for not connected fixed address clients | ||
314 | * should be silently discarded | ||
315 | */ | ||
316 | if (hdr_is_fixed(mei_hdr)) { | ||
317 | mei_irq_discard_msg(dev, mei_hdr); | ||
318 | ret = 0; | ||
319 | goto reset_slots; | ||
320 | } | ||
303 | dev_err(dev->dev, "no destination client found 0x%08X\n", | 321 | dev_err(dev->dev, "no destination client found 0x%08X\n", |
304 | dev->rd_msg_hdr); | 322 | dev->rd_msg_hdr); |
305 | ret = -EBADMSG; | 323 | ret = -EBADMSG; |