{PATCH] usbcore: fix bug in USB ID matching

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
This patch (as851) fixes a bug introduced when the USB ID matching
code was refactored.  If any of the device-level matches fail we
should reject right away.  Instead, when none of the device-level
matches fail the current code accepts right away.

Signed-off-by: Alan Stern <[email protected]>

---

Greg:

I realized that this really is a bug.  Consider for example the 
USB_INTERFACE_INFO() macro.  It creates match entries that specify only 
interface-level values, not device-level values.  So usb_match_device() 
will not find any mismatches and will return 1.  At that point you don't 
want to accept immediately; you want to go on and test for interface-level 
mismatches.

Alan Stern



Index: usb-2.6/drivers/usb/core/driver.c
===================================================================
--- usb-2.6.orig/drivers/usb/core/driver.c
+++ usb-2.6/drivers/usb/core/driver.c
@@ -415,8 +415,8 @@ int usb_match_one_id(struct usb_interfac
 	intf = interface->cur_altsetting;
 	dev = interface_to_usbdev(interface);
 
-	if (usb_match_device(dev, id))
-		return 1;
+	if (!usb_match_device(dev, id))
+		return 0;
 
 	/* The interface class, subclass, and protocol should never be
 	 * checked for a match if the device class is Vendor Specific,


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.