Re: [PATCH] usb gadget: fix null pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Yang Ruirui | 2011-08-16 18:01:54 [+0800]:

>diff -uprN a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
>--- a/drivers/usb/gadget/composite.c	2011-08-16 17:49:38.813038094 +0800
>+++ b/drivers/usb/gadget/composite.c	2011-08-16 17:47:03.716372207 +0800
>@@ -603,6 +603,7 @@ static int set_config(struct usb_composi
> 	int			result = -EINVAL;
> 	unsigned		power = gadget_is_otg(gadget) ? 8 : 100;
> 	int			tmp;
>+	enum usb_device_speed	s = USB_SPEED_LOW;
> 
> 	if (number) {
> 		list_for_each_entry(c, &cdev->configs, list) {
>@@ -626,6 +627,14 @@ static int set_config(struct usb_composi
> 		result = 0;
> 	}
> 
>+	if (c->fullspeed && (gadget->speed == USB_SPEED_FULL))
>+		s = USB_SPEED_FULL;
>+	if (c->highspeed && (gadget->speed == USB_SPEED_HIGH))
>+		s = USB_SPEED_HIGH;
>+	if (c->superspeed && (gadget->speed == USB_SPEED_SUPER))
>+		s = USB_SPEED_SUPER;
>+	gadget->speed = s;
>+

I'm not sure if this is the right way. After all the speed is still HS
we just use FS descriptors. And I'm not sure if changing the speed is a
wise thing to do.
Is this a regression from recent changes in the framework?

What about config_ep_by_speed(), config_buf(), set_config() not assigned
a null pointer in the first place?

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux