forked fromtorvalds/linux
- Notifications
You must be signed in to change notification settings - Fork0
Commit3fce396
usbcore/driver: Accommodate usbip
Commit88b7381 ("USB: Select better matching USB drivers whenavailable") inadvertently broke usbip functionality. The commit inquestion allows USB device drivers to be explicitly matched withUSB devices via the use of driver-provided identifier tables andmatch functions, which is useful for a specialised device driverto be chosen for a device that can also be handled by another,more generic, device driver.Prior, the USB device section of usb_device_match() had anunconditional "return 1" statement, which allowed user-space to bindUSB devices to the usbip_host device driver, if desired. However,the aforementioned commit changed the default/fallback returnvalue to zero. This breaks device drivers such as usbip_host, sothis commit restores the legacy behaviour, but only if a devicedriver does not have an id_table and a match() function.In addition, if usb_device_match is called for a device driverand device pair where the device does not match the id_table of thedevice driver in question, then the device driver will be disqualifiedfor the device. This allows avoiding the default case of "return 1",which prevents undesirable probe() calls to a driver even thoughits id_table did not match the device.Finally, this commit changes the specialised-driver-to-generic-drivertransition code so that when a device driver returns -ENODEV, a moregeneric device driver is only considered if the current device driverdoes not have an id_table and a match() function. This ensures that"generic" drivers such as usbip_host will not be considered specialiseddevice drivers and will not cause the device to be locked in to thegeneric device driver, when a more specialised device driver could betried.All of these changes restore usbip functionality without regressions,ensure that the specialised/generic device driver selection logic worksas expected with the usb and apple-mfi-fastcharge drivers, and do notnegatively affect the use of devices provided by dummy_hcd.Fixes:88b7381 ("USB: Select better matching USB drivers when available")Cc: <stable@vger.kernel.org> # 5.8Cc: Bastien Nocera <hadess@hadess.net>Cc: Valentina Manea <valentina.manea.m@gmail.com>Cc: Shuah Khan <shuah@kernel.org>Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>Cc: Alan Stern <stern@rowland.harvard.edu>Cc: <syzkaller@googlegroups.com>Tested-by: Andrey Konovalov <andreyknvl@google.com>Acked-by: Shuah Khan <skhan@linuxfoundation.org>Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com>Link:https://lore.kernel.org/r/20200922110703.720960-5-m.v.b@runbox.comSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent4df30e7 commit3fce396
1 file changed
+31
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
272 | 293 | | |
273 | | - | |
| 294 | + | |
| 295 | + | |
274 | 296 | | |
275 | 297 | | |
276 | 298 | | |
| |||
831 | 853 | | |
832 | 854 | | |
833 | 855 | | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
| 856 | + | |
| 857 | + | |
838 | 858 | | |
839 | 859 | | |
840 | 860 | | |
841 | | - | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
842 | 867 | | |
843 | 868 | | |
844 | 869 | | |
| |||
0 commit comments
Comments
(0)