forked fromtorvalds/linux
- Notifications
You must be signed in to change notification settings - Fork0
Commit4df30e7
usbcore/driver: Fix incorrect downcast
This commit resolves a minor bug in the selection/discovery of morespecific USB device drivers for devices that are currently bound togeneric USB device drivers.The bug is related to the way a candidate USB device driver iscompared against the generic USB device driver. The code inis_dev_usb_generic_driver() assumes that the device driver in questionis a USB device driver by calling to_usb_device_driver(dev->driver)to downcast; however I have observed that this assumption is not alwaystrue, through code instrumentation.This commit avoids the incorrect downcast altogether by comparingthe USB device's driver (i.e., dev->driver) to the generic USBdevice driver directly. This method was suggested by Alan Stern.This bug was found while investigating Andrey Konovalov's reportindicating usbip device driver misbehaviour with the recently mergedgeneric USB device driver selection feature. The report is linkedbelow.Fixes:d5643d2 ("USB: Fix device driver race")Cc: <stable@vger.kernel.org> # 5.8Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>Cc: Alan Stern <stern@rowland.harvard.edu>Cc: Bastien Nocera <hadess@hadess.net>Cc: Shuah Khan <shuah@kernel.org>Cc: Valentina Manea <valentina.manea.m@gmail.com>Cc: <syzkaller@googlegroups.com>Tested-by: Andrey Konovalov <andreyknvl@google.com>Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com>Link:https://lore.kernel.org/r/20200922110703.720960-4-m.v.b@runbox.comSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parentaea850c commit4df30e7
1 file changed
+2
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | 908 | | |
917 | 909 | | |
918 | 910 | | |
919 | 911 | | |
920 | 912 | | |
921 | 913 | | |
922 | | - | |
| 914 | + | |
| 915 | + | |
923 | 916 | | |
924 | 917 | | |
925 | 918 | | |
| |||
0 commit comments
Comments
(0)