1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-03 12:11:33 +01:00

scd: Fix SEGV in CCID driver.

* scd/ccid-driver.c (intr_cb): Only kick the loop for removal.
(bulk_in): Don't set POWERED_OFF when interrupt transfer is enabled.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2017-07-21 13:26:53 +09:00
parent a76b6cf970
commit d8a55da715

View File

@ -1487,6 +1487,7 @@ intr_cb (struct libusb_transfer *transfer)
{ {
DEBUGOUT ("CCID: card removed\n"); DEBUGOUT ("CCID: card removed\n");
handle->powered_off = 1; handle->powered_off = 1;
scd_kick_the_loop ();
} }
else else
{ {
@ -1501,9 +1502,8 @@ intr_cb (struct libusb_transfer *transfer)
device_removed: device_removed:
DEBUGOUT ("CCID: device removed\n"); DEBUGOUT ("CCID: device removed\n");
handle->powered_off = 1; handle->powered_off = 1;
scd_kick_the_loop ();
} }
scd_kick_the_loop ();
} }
static void static void
@ -2043,8 +2043,11 @@ bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length,
* Possibly, it was forcibly suspended and resumed. * Possibly, it was forcibly suspended and resumed.
*/ */
DEBUGOUT ("CCID: card inactive/removed\n"); DEBUGOUT ("CCID: card inactive/removed\n");
handle->powered_off = 1; if (handle->transfer == NULL)
scd_kick_the_loop (); {
handle->powered_off = 1;
scd_kick_the_loop ();
}
} }
return rc; return rc;