From da733f3aae80afa30f6d12a3032972eb08d06635 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Thu, 22 Jan 2015 11:53:10 -0800 Subject: [PATCH] lm4: ignore overlapping LPC commands If the AP ignores the LPC_ST_BUSY bit (which is software-defined) and tries to send a second host command while the first one is still processed, we discard it. This doesn't prevent the host to re-write the command arguments stored in LPC shared mem (aka LPC_POOL_CMD_DATA) but when we will call host_packet_receive, we will have either the old arguments or the new arguments (or even a mix of both, which is less unlikely to pass the checksum check), and we will copy them once before calling the HOSTCMD task. So the host command task will have a single coherent (not changing) view of the arguments when performing its input validation. Signed-off-by: Vincent Palatin BRANCH=samus BUG=chrome-os-partner:31492 chrome-os-partner:23806 TEST=Boot Samus and play with ectool Change-Id: I9aa1b8cdac05e323b91998188bd873826e83c274 Reviewed-on: https://chromium-review.googlesource.com/242593 Reviewed-by: Randall Spangler Reviewed-by: Alec Berg Tested-by: Vincent Palatin Commit-Queue: Vincent Palatin Trybot-Ready: Vincent Palatin Reviewed-by: Kees Cook --- chip/lm4/lpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c index 6bab4fb761..0f3e9b8b1c 100644 --- a/chip/lm4/lpc.c +++ b/chip/lm4/lpc.c @@ -473,8 +473,8 @@ static void handle_acpi_write(int is_cmd) */ static void handle_host_write(int is_cmd) { - /* Ignore data writes */ - if (!is_cmd) { + /* Ignore data writes or overlapping commands from host */ + if (!is_cmd || (LM4_LPC_ST(LPC_CH_CMD) & LM4_LPC_ST_BUSY)) { LM4_LPC_ST(LPC_CH_CMD) &= ~LM4_LPC_ST_FRMH; return; }