Re: [PATCH] usb/gadget: composite.c missing null pointer check

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

 



On Thu, 26 May 2011, Jon Pry wrote:

> I was getting crashes here when descriptors ended up being null. I
> believe the problem is that there are more possibilities for
> gadget->speed than are actually handled.

It looks like the real problem is that your function driver isn't 
providing the descriptors it is supposed to provide.

>  On my platform i used a patch
> that will attempt to use any descriptor if one is available but I do
> not know enough about the system to say whether or not that is a sane
> solution. This at least stops null pointer crashes in the kernel.
> 
> ~Jon Pry jonpry@xxxxxxxxx
> 
> --- a/composite.c    2011-05-26 10:20:17.968389505 -0400
> +++ b/composite.c    2011-05-26 10:20:48.028388867 -0400
> @@ -440,7 +440,7 @@
>          else
>              descriptors = f->descriptors;
> 
> -        for (; *descriptors; ++descriptors) {
> +        for (; descriptors && *descriptors; ++descriptors) {
>              struct usb_endpoint_descriptor *ep;
>              int addr;

Instead of changing composite.c, you should try to fix the broken 
function driver.

Alan Stern

--
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