astlpc: Warn on unexpected commands before binding has started
We should receive neither `Tx Begin` nor `Rx Complete` prior to
sending or receiving `Channel Init`. If we do, warn about it and don't
proceed to process the unexpected message.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ib154436305afe291f2cc71bbb861edd8362e42e3
diff --git a/astlpc.c b/astlpc.c
index 75318eb..e8b3cd5 100644
--- a/astlpc.c
+++ b/astlpc.c
@@ -914,6 +914,12 @@
astlpc_prdebug(astlpc, "%s: data: 0x%hhx", __func__, data);
+ if (!astlpc->version && !(data == 0x0 || data == 0xff)) {
+ astlpc_prwarn(astlpc, "Invalid message for binding state: 0x%x",
+ data);
+ return 0;
+ }
+
switch (data) {
case 0x0:
mctp_astlpc_init_channel(astlpc);