laforge has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42776?usp=email )
Change subject: 7816fsm: Handle unexpected procedure bytes gracefully
......................................................................
7816fsm: Handle unexpected procedure bytes gracefully
Dispatch TPDU_FAILED_IND and don't assert for wrong procedure bytes.
Closes:SYS#8050
Change-Id: Ic53814540775f902fce644a5565a7bd2f177a7fe
---
M ccid_common/iso7816_fsm.c
1 file changed, 7 insertions(+), 3 deletions(-)
Approvals:
laforge: Looks good to me, approved; Verified
diff --git a/ccid_common/iso7816_fsm.c b/ccid_common/iso7816_fsm.c
index 4e4c2b1..9899e16 100644
--- a/ccid_common/iso7816_fsm.c
+++ b/ccid_common/iso7816_fsm.c
@@ -1398,8 +1398,11 @@
card_uart_ctrl(ip->uart,
CUART_CTL_RX_TIMER_HINT, 1);
osmo_fsm_inst_state_chg(fi, TPDU_S_RX_SINGLE,
0, 0);
}
- } else
- OSMO_ASSERT(0);
+ } else {
+ LOGPFSML(fi, LOGL_ERROR, "Unexpected byte 0x%02x in
procedure state (INS=0x%02x)\n", byte, tpduh->ins);
+ osmo_fsm_inst_state_chg(fi, TPDU_S_DONE, 0, 0);
+ osmo_fsm_inst_dispatch(fi->proc.parent,
ISO7816_E_TPDU_FAILED_IND, tfp->tpdu);
+ }
break;
default:
OSMO_ASSERT(0);
@@ -1616,7 +1619,8 @@
S(TPDU_S_RX_SINGLE) |
S(TPDU_S_TX_REMAINING) |
S(TPDU_S_TX_SINGLE) |
- S(TPDU_S_SW2),
+ S(TPDU_S_SW2) |
+ S(TPDU_S_DONE),
.action = tpdu_s_procedure_action,
},
[TPDU_S_TX_REMAINING] = {
--
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42776?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: Ic53814540775f902fce644a5565a7bd2f177a7fe
Gerrit-Change-Number: 42776
Gerrit-PatchSet: 3
Gerrit-Owner: Hoernchen <[email protected]>
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: lynxis lazus <[email protected]>