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

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

 



On 08/17/2011 09:49 AM, Yang Ruirui R wrote:
On 08/16/2011 06:38 PM, Sebastian Andrzej Siewior wrote:
* 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?

Indeed, 3.0-rc7 works. I tried to bisect this issue, but kernel stall after
"Uncompressing Linux... done, booting the kernel" in the middle commits.

Do you know some suspicious commits I can revert to debug?


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

It is in composite.c:set_config

Maybe I misunderstood your points, I did not see the null assign yet.
I will continue to debug this issue.



Sebastian




--
Thanks
Yang Ruirui
--
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