Home GnuPG
Diffusion GnuPG 8e206c172156

scd: Internal CCID driver: Fix a race condition on close.

Description

scd: Internal CCID driver: Fix a race condition on close.

* scd/ccid-driver.c (ccid_require_get_status): For VENDOR_SCM reader,
return 0 only at the initial call.
(bulk_in): Don't detect an error for VENDOR_SCM reader, just kicking
the loop, to invoke scd_update_reader_status_file, which calls
ccid_slot_status again.
(ccid_slot_status): Move the call of ccid_vendor_specific_setup to...
(ccid_get_atr): ... here.

For readers with interrupt transfer support, it is only intr_cb which
sets handle->powered_off to 1. Keeping this condition makes no race.
The function ccid_slot_status can also detect a communication error,
which causes apdu_close_reader (but not setting ->powered_off).

(cherry picked from commit 484bafda4dbf5ffe9e7c41ef24fbc5bd791a3b32)

Details

Provenance
gniibeAuthored on Nov 5 2020, 7:10 AM
wernerCommitted on Nov 9 2020, 1:26 PM
Parents
rG7f765a98fd66: card: Run factory-reset in locked stated.
Branches
Unknown
Tags
Unknown
Tasks
T5121: a race condition between intr_cb call back and libusb_free_transfer in do_close_reader