Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaea850c

Browse files
m-v-bgregkh
authored andcommitted
usbcore/driver: Fix specific driver selection
This commit resolves a bug in the selection/discovery of morespecific USB device drivers for devices that are currently bound togeneric USB device drivers.The bug is in the logic that determines whether a device currentlybound to a generic USB device driver should be re-probed by amore specific USB device driver or not. The code in__usb_bus_reprobe_drivers() used to have the following lines: if (usb_device_match_id(udev, new_udriver->id_table) == NULL && (!new_udriver->match || new_udriver->match(udev) != 0)) return 0; ret = device_reprobe(dev);As the reader will notice, the code checks whether the USB device inconsideration matches the identifier table (id_table) of a specificUSB device_driver (new_udriver), followed by a similar check, but thistime with the USB device driver's match function. However, the matchfunction's return value is not checked correctly. When match() returnszero, it means that the specific USB device driver is *not* applicableto the USB device in question, but the code then goes on to reprobe thedevice with the new USB device driver under consideration. All this tosay, the logic is inverted.This bug was found by code inspection and instrumentation whileinvestigating the root cause of the issue reported by Andrey Konovalov,where usbip took over syzkaller's virtual USB devices in an undesiredmanner. The report is linked below.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-3-m.v.b@runbox.comSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parentd640761 commitaea850c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎drivers/usb/core/driver.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ static int __usb_bus_reprobe_drivers(struct device *dev, void *data)
924924

925925
udev=to_usb_device(dev);
926926
if (usb_device_match_id(udev,new_udriver->id_table)==NULL&&
927-
(!new_udriver->match||new_udriver->match(udev)!=0))
927+
(!new_udriver->match||new_udriver->match(udev)==0))
928928
return0;
929929

930930
ret=device_reprobe(dev);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp