Your message dated Wed, 20 Apr 2016 10:19:44 +0000
with message-id <[email protected]>
and subject line Bug#821787: fixed in ccid 1.4.23-1
has caused the Debian Bug report #821787,
regarding cleanup libusb when open fails
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
821787: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=821787
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: libccid
Version: 1.4.22-1
Tags: patch
Severity: important

Hi,

after suspend/resume pcscd burns a core:

---
[pid 23458] poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}], 2, 4294967295) 
= 1 ([{fd=5, revents=POLLIN}])
[pid 23458] recvmsg(11, 0x7f0332553d80, 0) = -1 EAGAIN (Resource temporarily 
unavailable)
[pid 23458] poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}], 2, 4294967295) 
= 1 ([{fd=5, revents=POLLIN}])
[pid 23458] recvmsg(11, 0x7f0332553d80, 0) = -1 EAGAIN (Resource temporarily 
unavailable)
---

Some rounds of debugging and reading source lead me to a bug in ccid:
after initializing a certain reader failed pcscd unloads ccid, which
unloads libusb without proper cleanup.

This leads to various race conditions if libusb gets loaded again
later, and might crash pcscd in other cases.

---
Apr 19 10:08:13 $hostname systemd[1]: Started PC/SC Smart Card Daemon.
Apr 19 10:08:13 $hostname pcscd[10047]: 00000000 
ifdhandler.c:144:CreateChannelByNameOrChannel() failed
Apr 19 10:08:13 $hostname pcscd[10047]: 00000036 
readerfactory.c:1097:RFInitializeReader() Open Port 0x200000 Failed 
(usb:0a5c/5800:libudev:0:/dev/bus/usb/004/003)
Apr 19 10:08:13 $hostname pcscd[10047]: 00000004 
readerfactory.c:372:RFAddReader() Broadcom Corp 5880 [Broadcom USH] 
(0123456789ABCD) init failed.
---

See attached patch for a fix.

- Stefan
Description: cleanup libusb when open fails
 When OpenUSBByName fails it needs to call close_libusb_if_needed to
 cleanup the libusb context. Otherwise variouses resources (memory, file
 descriptors) leak and the linux_udev_event_thread_main thread keeps
 running when libccid gets dlclosed(). This results in very ugly race
 conditions if the library gets loaded again and
 linux_udev_event_thread_main gets started a second time.
 .
 This might resolve a number of issues involving pcscs crashing or
 burning 100% CPU: debian #749584, debian #718473, ubuntu #1296288
Author: Stefan Bühler <[email protected]>
Last-Update: 2016-04-19
--- ccid-1.4.22.orig/src/ccid_usb.c
+++ ccid-1.4.22/src/ccid_usb.c
@@ -724,6 +724,9 @@ end:
 			goto again_libusb;
 		}
 #endif
+
+		if (ctx) close_libusb_if_needed();
+
 		if (claim_failed)
 			return STATUS_COMM_ERROR;
 		DEBUG_INFO1("Device not found?");
@@ -739,6 +742,8 @@ end2:
 	libusb_free_device_list(devs, 1);
 
 end1:
+	if (ctx) close_libusb_if_needed();
+
 	/* free bundle list */
 	bundleRelease(&plist);
 

Attachment: pgpJnYUhSpW5R.pgp
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
Source: ccid
Source-Version: 1.4.23-1

We believe that the bug you reported is fixed in the latest version of
ccid, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Ludovic Rousseau <[email protected]> (supplier of updated ccid package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Wed, 20 Apr 2016 10:10:11 +0200
Source: ccid
Binary: libccid
Architecture: source amd64
Version: 1.4.23-1
Distribution: unstable
Urgency: medium
Maintainer: Ludovic Rousseau <[email protected]>
Changed-By: Ludovic Rousseau <[email protected]>
Description:
 libccid    - PC/SC driver for USB CCID smart card readers
Closes: 812087 821787
Changes:
 ccid (1.4.23-1) unstable; urgency=medium
 .
   * New upstream release
   * Fix "cleanup libusb when open fails" fixed upstream (Closes: #821787)
   * Fix "pcscd takes 100 % cpu each time I insert a mass storage USB
     key" fixed upstream (Closes: #812087)
   * debian/control: use https:// for Vcs-Browser:
     Fix lintian warning vcs-field-uses-insecure-uri vcs-browser
   * debian/control: Standards-Version: 3.9.6 -> 3.9.8. No change needed.
Checksums-Sha1:
 4c5afe634be906b6c534a0a8a1ac785b3762e326 1899 ccid_1.4.23-1.dsc
 0b49b159157d9732c5506d7eeb61a325121dfa30 593254 ccid_1.4.23.orig.tar.bz2
 09dda8907bbca9610db99d26522a15480c739626 6524 ccid_1.4.23-1.debian.tar.xz
 7a26e0f8fd8b7540fc8fb1356765b043f1b7cbda 165910 
libccid-dbgsym_1.4.23-1_amd64.deb
 5ed33f6c78797b498c8d09674bac79f1ad197905 308920 libccid_1.4.23-1_amd64.deb
Checksums-Sha256:
 2f2b4babc825f7909bc4dded037bd609088dc3a2fd666c138e72399f9312e2af 1899 
ccid_1.4.23-1.dsc
 0836adceb6eee2925e9933e377a4c8cc86a285525c2b54520ad0da16d113ec68 593254 
ccid_1.4.23.orig.tar.bz2
 3d485eda21d680d2edbed8ee7dcfb246bf86df4a8049bc7d65ef0b1225e58971 6524 
ccid_1.4.23-1.debian.tar.xz
 f48f49200c50db7288a009cb3a56012bde327e44d89e40bc5a3cab0398e6fc62 165910 
libccid-dbgsym_1.4.23-1_amd64.deb
 c1dfa4fce8d40b55d9277c6192a41f22009a171616071e4d514e5d025900ddb2 308920 
libccid_1.4.23-1_amd64.deb
Files:
 92bfdebcdf6d1381edef3fdeea03bd0c 1899 libs extra ccid_1.4.23-1.dsc
 b0bb7f9a663cd2891e49befa30d0f110 593254 libs extra ccid_1.4.23.orig.tar.bz2
 493d995704ecd6df15b73c2378db0e1e 6524 libs extra ccid_1.4.23-1.debian.tar.xz
 7aadb56302783f6cda3c3581200510d6 165910 debug extra 
libccid-dbgsym_1.4.23-1_amd64.deb
 81ab15d3833656220236f2abda79017c 308920 libs extra libccid_1.4.23-1_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXFz8pAAoJEHihtN/o+cV+LC0P/1rL3BIG8SeA6zRjHPVENUSR
+uZlx/T3qVAoTQ9j8PLz3coUi0c3vcI7CCHhQM9pfJXkgr1lagE9DcXkT30SGc40
39RYWf5kedZbLpiHoVzC/u7gFrJfWunQF6R1aW4Wh4mCWgdWEJBXwwHV58tawOMH
ylX0DI9I1j54V55Xf37ECb/QIiI7FlFmRoUTyMPAYpxCtjLvB9yxNEHwWwIJuCmQ
xF2os/M1hTYCBtdbCNXmVDnKHou3dVbGNnI/RcstMzAZNaaFzq7+hwsljvdiMabC
RU2pHsL1edesIH4yp8hInfbeltVdPlDjCQj+GyB+Frpr1bC5iEtIa6igLkhYT4fO
ROi+xSCBaQBfIs1SawUbwZEC08dwrK3zM1+FBY3wqVRlLt+vsKjpwFO3PtFu8cMV
A3+OXzTKH2FNYF9WS93XsgVqCYq7c4KSjXpeAewMvt0sxeSxKsG707va0JzmdXhT
htthLfN19OGOQyM3XSIs4S9sFsxao5a8k2qU3H88hMOnaLjD09Uwd1h9vBWeq+pd
BZcrlmjTCMYxAOSP5x3N97DNG91eTikFXBcSH7DNi13/4GHQeH35vi7hGzBkud7Q
23HAFaLSHP+RSeGDWEKLdMQ+HmXUQiVWbzKVH4BUKOd/GvJZmWBbyODrpMU8gLY1
tBjlabf+tOqu5qgadEv8
=0uBt
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to