USB: don't choose configs with no interfaces

Previous thread: USB: rename usb_buffer_alloc() and usb_buffer_free() by Linux Kernel Mailing List on Friday, April 30, 2010 - 10:59 am. (1 message)

Next thread: USB: gadget: s3c-hsotg: Add missing unlock by Linux Kernel Mailing List on Friday, April 30, 2010 - 10:59 am. (1 message)
From: Linux Kernel Mailing List
Date: Friday, April 30, 2010 - 10:59 am

Gitweb:     http://git.kernel.org/linus/62f9cfa3ece58268b3e92ca59c23b175f86205aa
Commit:     62f9cfa3ece58268b3e92ca59c23b175f86205aa
Parent:     c3baa19b0a9b711b02cec81d9fea33b7b9628957
Author:     Alan Stern <stern@rowland.harvard.edu>
AuthorDate: Tue Apr 20 10:40:59 2010 -0400
Committer:  Greg Kroah-Hartman <gregkh@suse.de>
CommitDate: Fri Apr 30 09:25:10 2010 -0700

    USB: don't choose configs with no interfaces
    
    This patch (as1372) fixes a bug in the routine that chooses the
    default configuration to install when a new USB device is detected.
    The algorithm is supposed to look for a config whose first interface
    is for a non-vendor-specific class.  But the way it's currently
    written, it will also accept a config with no interfaces at all, which
    is not very useful.  (Believe it or not, such things do exist.)
    
    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
    Tested-by: Andrew Victor <avictor.za@gmail.com>
    Cc: stable <stable@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/usb/core/generic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
index bdf87a8..2c95153 100644
--- a/drivers/usb/core/generic.c
+++ b/drivers/usb/core/generic.c
@@ -120,7 +120,7 @@ int usb_choose_configuration(struct usb_device *udev)
 		 * than a vendor-specific driver. */
 		else if (udev->descriptor.bDeviceClass !=
 						USB_CLASS_VENDOR_SPEC &&
-				(!desc || desc->bInterfaceClass !=
+				(desc && desc->bInterfaceClass !=
 						USB_CLASS_VENDOR_SPEC)) {
 			best = c;
 			break;
--

Previous thread: USB: rename usb_buffer_alloc() and usb_buffer_free() by Linux Kernel Mailing List on Friday, April 30, 2010 - 10:59 am. (1 message)

Next thread: USB: gadget: s3c-hsotg: Add missing unlock by Linux Kernel Mailing List on Friday, April 30, 2010 - 10:59 am. (1 message)