Prevent LLCP stack from deactiving twice.
Some parts of the code reset the state to an operation state,
even if the link has already been shutdown. This allowed for a second
deactivation callback, causing a crash higher up in the stack.
Bug: 5765077
Change-Id: I2f2ac720756353d45d82634d27a3dd9acecae43d
diff --git a/src/phFriNfc_Llcp.c b/src/phFriNfc_Llcp.c
index 2a4fcb4..1f66216 100644
--- a/src/phFriNfc_Llcp.c
+++ b/src/phFriNfc_Llcp.c
@@ -627,7 +627,7 @@
}
/* Reset state */
- Llcp->state = PHFRINFC_LLCP_STATE_CHECKED;
+ Llcp->state = PHFRINFC_LLCP_STATE_DEACTIVATION;
switch (state)
{
@@ -717,7 +717,7 @@
{
Llcp->state = PHFRINFC_LLCP_STATE_OPERATION_RECV;
}
- else
+ else if (Llcp->state != PHFRINFC_LLCP_STATE_DEACTIVATION)
{
/* Not yet in OPERATION state, perform first reset */
if (Llcp->eRole == phFriNfc_LlcpMac_ePeerTypeInitiator)