[Pcsclite-git-commit] [CCID] 04/08: Fix a busy loop consuming 100% of CPU
Ludovic Rousseau
rousseau at moszumanska.debian.org
Tue Apr 19 19:10:25 UTC 2016
This is an automated email from the git hooks/post-receive script.
rousseau pushed a commit to branch master
in repository CCID.
commit 3c21f452543983f3625a1965ce234074cbda6865
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date: Tue Apr 19 20:30:06 2016 +0200
Fix a busy loop consuming 100% of CPU
If opening a reader fails then we must call close_libusb_if_needed() to
free any libusb resources and stop the libusb hotplug thread.
The problem as been detected with the Yubico Yubikey NEO U2F+CCID and
the 2 Boardcom devices. These devices are composite USB devices so
loading the CCID driver for a non-CCID interface was calling
libusb_init() but not libusb_exit(). The libusb hotplug thread and other
libusb allocated resources were not stopped and unallocated. On the next
USB plug (even if not CCID) then an endless busy loop is started inside
libusb hotplug.
Fixes:
- Debian bug #812087
"pcscd takes 100 % cpu each time I insert a mass storage USB key"
- Debian bug #821787
"cleanup libusb when open fails"
- Ubuntu bug #1572004
"pcscd consumes 100% CPU"
- Ubuntu bug #1551897
"Excessive CPU utilization"
Thanks a lot to Stefan Bühler for the analysis and patch
https://bugs.debian.org/821787
---
src/ccid_usb.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/ccid_usb.c b/src/ccid_usb.c
index e08f219..6a097ea 100644
--- a/src/ccid_usb.c
+++ b/src/ccid_usb.c
@@ -727,6 +727,9 @@ end:
goto again_libusb;
}
#endif
+ /* failed */
+ close_libusb_if_needed();
+
if (claim_failed)
return STATUS_COMM_ERROR;
DEBUG_INFO1("Device not found?");
@@ -745,6 +748,9 @@ end1:
/* free bundle list */
bundleRelease(&plist);
+ if (return_value != STATUS_SUCCESS)
+ close_libusb_if_needed();
+
return return_value;
} /* OpenUSBByName */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/CCID.git
More information about the Pcsclite-cvs-commit
mailing list