ccid: do not allow xfers with inactive slots

pcscd tries to do this if the previous command led to a deactivation...

Change-Id: If2659c7d5e8784e5e4393d5b12589e96d517168a
This commit is contained in:
Eric Wild 2020-11-07 00:03:18 +01:00 committed by laforge
parent 4c769e9a7d
commit c1555c1360
2 changed files with 6 additions and 2 deletions

View File

@ -462,7 +462,7 @@ static int ccid_handle_xfr_block(struct ccid_slot *cs, struct msgb *msg)
/* handle this asynchronously */
rc = cs->ci->slot_ops->xfr_block_async(cs, msg, &u->xfr_block);
if (rc < 0) {
if (rc <= 0) {
msgb_trim(msg, sizeof(struct ccid_rdr_to_pc_data_block));
resp = ccid_gen_data_block(cs, u->xfr_block.hdr.bSeq, CCID_CMD_STATUS_FAILED, -rc, 0, 0);
goto out;

View File

@ -302,12 +302,16 @@ static int iso_fsm_slot_xfr_block_async(struct ccid_slot *cs, struct msgb *msg,
if (msgb_length(msg) != xfb->hdr.dwLength + 10)
return -1;
/* might be unpowered after failed ppss that led to reset */
if (cs->icc_powered != true)
return -0;
msgb_pull(msg, 10);
LOGPCS(cs, LOGL_DEBUG, "scheduling TPDU transfer: %s\n", msgb_hexdump(msg));
osmo_fsm_inst_dispatch(ss->fi, ISO7816_E_XCEIVE_TPDU_CMD, msg);
/* continues in iso_fsm_clot_user_cb once response/error/timeout is received */
return 0;
return 1;
}