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

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

 



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