usb: Don't call usb_msc_auto_quirk for UQ_MSC_IGNORE devices

usb_msc_auto_quirk() potentially crashes usb devices with a hidden
storage (see bug 287333). These devices may still operate normally if
usb_msc_auto_quirk() would not be called all and the hidden storage is
ignored. This patch makes sure, that usb_msc_auto_quirk() is not called
when the UQ_MSC_IGNORE quirk is set for a device. It shouldn't be called
anyway if the hidden storage supposed to be ignored. This gives users a
chance to get their devices working by using

'usbconfig add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> UQ_MSC_IGNORE'.

Reviewed by: imp
MFC After: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1716
Closes: https://github.com/freebsd/freebsd-src/pull/1716
This commit is contained in:
Jan Biedermann 2025-06-06 15:38:21 +02:00 committed by Warner Losh
parent 37983aef7c
commit c2794499be

View file

@ -2068,7 +2068,8 @@ repeat_set_config:
usb_test_quirk(&uaa, UQ_MSC_NO_SYNC_CACHE) == 0 &&
usb_test_quirk(&uaa, UQ_MSC_NO_TEST_UNIT_READY) == 0 &&
usb_test_quirk(&uaa, UQ_MSC_NO_GETMAXLUN) == 0 &&
usb_test_quirk(&uaa, UQ_MSC_NO_INQUIRY) == 0) {
usb_test_quirk(&uaa, UQ_MSC_NO_INQUIRY) == 0 &&
usb_test_quirk(&uaa, UQ_MSC_IGNORE) == 0) {
/*
* Try to figure out if there are any MSC quirks we
* should apply automatically: