mbox series

[0/2] Patches to prevent re-probing all Apple USB devices on apple-mfi-fastcharge load

Message ID 20201022135521.375211-1-m.v.b@runbox.com (mailing list archive)
Headers show
Series Patches to prevent re-probing all Apple USB devices on apple-mfi-fastcharge load | expand

Message

M. Vefa Bicakci Oct. 22, 2020, 1:55 p.m. UTC
Hello all,

This thread is intended to continue the thread at [1], where Pany
reported an issue involving the apple-mfi-fastcharge driver. The
bug in question causes a re-probe of all Apple USB devices when the
driver in question is loaded, including an Apple SD card reader,
which in turn causes a boot-up failure. (The original bug report
is in the RedHat Bugzilla at [2].)

These two patches aim to resolve this issue by implementing a match
function in the apple-mfi-fastcharge driver to ensure that this driver
is only matched with devices it is intended to be used with, and by
modifying the USB core to ensure that when a device driver has an
ID table and a match function, they are both taken into account.
(The previous behaviour did not check the result of the driver's
match() if the driver's id_table matched the device.)

These changes have been verified to not cause regressions on a
5.8.16-based kernel by (1) verifying apple-mfi-fastcharge behaviour
with an iPhone, (2) running the usbip regression test to ensure that
the changes in USB core are harmless to usbip, and (3) using the
patched kernel with other USB devices (a keyboard, a mouse and a
webcam). Greg Kroah-Hartman's usb-next tree has been verified to
compile with these patches and was briefly runtime tested as well.
(The base commit in usb-next is listed below.)

Credits: The first patch was co-developed by Bastien Nocera and
myself, with the main idea (i.e., the use of id_table *and* the
match function) coming from Bastien. The second patch was
developed solely by Bastien, and I only added a few tags to the
patch description.

Bastien, sorry for the delay!

Thank you,

Vefa

[1] https://lore.kernel.org/linux-usb/CAE3RAxt0WhBEz8zkHrVO5RiyEOasayy1QUAjsv-pB0fAbY1GSw@mail.gmail.com/
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1878347

Cc: Bastien Nocera <hadess@hadess.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Pany <pany@fedoraproject.org>

Bastien Nocera (2):
  usbcore: Check both id_table and match() when both available
  USB: apple-mfi-fastcharge: don't probe unhandled devices

 drivers/usb/core/driver.c               | 30 +++++++++++++++++--------
 drivers/usb/core/generic.c              |  4 +---
 drivers/usb/core/usb.h                  |  2 ++
 drivers/usb/misc/apple-mfi-fastcharge.c | 17 +++++++++-----
 4 files changed, 36 insertions(+), 17 deletions(-)


base-commit: 270315b8235e3d10c2e360cff56c2f9e0915a252