aboutsummaryrefslogtreecommitdiffstats
path: root/scd/apdu.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2015-12-03 02:26:24 +0000
committerNIIBE Yutaka <[email protected]>2015-12-03 02:26:24 +0000
commitf42c50dbf00c2e6298ca6830cbe6d36805fa54a3 (patch)
tree1526b6169578ab61d7fc6b945cae265b5b51854f /scd/apdu.c
parentscd: Fix for Curve25519 prefix handling. (diff)
downloadgnupg-f42c50dbf00c2e6298ca6830cbe6d36805fa54a3.tar.gz
gnupg-f42c50dbf00c2e6298ca6830cbe6d36805fa54a3.zip
scd: Fix "Conflicting usage" bug.
* scd/apdu.c (apdu_close_reader): Call CLOSE_READER method even if we got an error from apdu_disconnect. * scd/app-common.h (no_reuse): Remove. * scd/app.c (application_notify_card_reset): Deallocate APP here. (select_application, release_application): Don't use NO_REUSE. -- Reproducible scenario: Invoke gpg --card-edit session from a terminal. Invoke another gpg --card-edit session from another. Remove a token. Insert a token again. Type RET on both terminals. One of terminal answers "Conflicting usage". Perhaps, having NO_REUSE field was to avoid race conditions. Now, APP can be safely deallocated by application_notify_card_reset. Thanks to the2nd.
Diffstat (limited to 'scd/apdu.c')
-rw-r--r--scd/apdu.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/scd/apdu.c b/scd/apdu.c
index eb3d4b68b..95a25611b 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -3215,9 +3215,12 @@ apdu_close_reader (int slot)
sw = apdu_disconnect (slot);
if (sw)
{
+ /*
+ * When the reader/token was removed it might come here.
+ * It should go through to call CLOSE_READER even if we got an error.
+ */
if (DBG_READER)
- log_debug ("leave: apdu_close_reader => 0x%x (apdu_disconnect)\n", sw);
- return sw;
+ log_debug ("apdu_close_reader => 0x%x (apdu_disconnect)\n", sw);
}
if (reader_table[slot].close_reader)
{