1. 18 Sep, 2003 3 commits
    • Alan Stern's avatar
      [PATCH] USB: Changes to core/config.c (8 of 9) · 69d7ab7d
      Alan Stern authored
      This patch adds some extra error checking.  The patch-comments list most
      it.  Particularly worth noting is the check on the endpoint addresses.
      Since these addresses are used as indexes for the epmaxpacketin and
      epmaxpacketout arrays, illegal values could result in overwriting
      unrelated areas of memory.
      
      Other noteworthy checks involve interface and alsetting numbers.  Since
      the old code ignored those values, of course it didn't bother to check
      them.  Here we make sure that the numbers lie in the proper ranges and
      that there are no "missing" entries.
      
       Add error checking and improved error messages:
         Check for invalid endpoint descriptors and invalid endpoint addresses.
         Check for duplicate interface/altsetting descriptors.
         Check for invalid configuration descriptors.
         Check for missing interface/altsetting descriptors.
      69d7ab7d
    • Alan Stern's avatar
      [PATCH] USB: Changes to core/config.c (7 of 9) · 104cc087
      Alan Stern authored
      This patch changes the usb_parse_interface() routine so that it only
      handles a single interface/altsetting descriptor at a time, rather than
      trying to handle all the altsettings for an interface at once.  Besides
      shrinking the code slightly, this has the advantage of not requiring the
      interfaces to be listed in order or all the altsetting descriptors for an
      interface to be contiguous.  While there probably aren't any devices that
      have _discontiguous_ altsetting descriptors, there's no harm in allowing
      it -- particularly since doing so provides an overall simplification.
      
      This is another of those hard-to-read patches.  It moves most of the body
      of the usb_parse_interface() function out of a loop, thereby changing the
      indentation level without actually altering the code.
      104cc087
    • Greg Kroah-Hartman's avatar
  2. 17 Sep, 2003 14 commits
    • Alan Stern's avatar
      [PATCH] USB: Changes to core/config.c (6 of 9) · 46c4d99b
      Alan Stern authored
      This patch removes the home-brewed resizeable arrays used to store
      altsetting structures, along with the now-unneeded max_altsetting field.
      Since we are already making a preliminary pass through all the descriptors
      to check their lengths, we take the opportunity to also count the number
      of altsetting descriptors for each interface.  Then exactly the right
      number can be allocated all at once.
      
      This also moves the code that allocates the altsettings outside the
      usb_parse_interface() routine.  Though not important now, this change will
      come in handy in the next patch.
      46c4d99b
    • Alan Stern's avatar
      [PATCH] USB: Changes to core/config.c (5 of 9) · 5446ab92
      Alan Stern authored
      This patch centralizes the error checking for invalid descriptor lengths
      and unexpected descriptor types.  Instead of doing it in three different
      places -- while parsing configuration, interface, and endpoint descriptors
      -- the new code does it all at once.  Not surprisingly, this yields a net
      savings in code size.
      5446ab92
    • Alan Stern's avatar
      [PATCH] USB: Changes to core/config.c (4 of 9) · 43345b84
      Alan Stern authored
      Although it's hard to tell from reading the patch, this just moves one
      section of code to a slightly different spot.  Currently the code that
      skips over the extra class- and vendor-specific configuration-related
      descriptors is part of the loop that parses interface descriptors.  The
      patch moves it outside, immediately before that loop -- where it belongs.
      43345b84
    • Alan Stern's avatar
      [PATCH] USB: Changes to core/config.c (3 of 9) · 580d2f45
      Alan Stern authored
      This patch includes a bunch of little local improvements to the code,
      listed in the patch comments.  There are only two notable changes.  If a
      device has more configurations than our maximum, the code doesn't reject
      the device but simply parses as many configurations as it can and ignores
      the rest.  Likewise, if a configuration contains too many interfaces, the
      code parses as many as it can and skips the excess.  That way such devices
      will be at least partially useable.  Since these limits are arbitrary and
      set by the implementation (not part of the USB spec), it doesn't make
      sense to reject a device that violates them.
      
       Numerous local programming improvements:
         Don't initialize to 0 fields in structures that have been memset to 0.
         Don't constantly keep track of how many bytes are parsed.
         Use local variables to hold unwieldy values.
         Remove redundant tests.
         Allow devices to have more configurations or interfaces than we can handle.
      580d2f45
    • Alan Stern's avatar
      [PATCH] USB: Changes to core/config.c (2 of 9) · 8fc9363d
      Alan Stern authored
      This patch fixes the most blatant problems that can happen when an error
      is encountered during descriptor parsing.
      
      	The struct device embedded within a struct usb_interface is
      initialized as soon as the structure is allocated, so that when
      put_device() is called it will contain valid data.
      
      	put_device() is not called for unallocated interfaces.
      
      	The pointers in config->extra are freed when the struct
      usb_host_config is freed.
      
      	rawdescriptor pointers are initialized to 0 so that they can be
      freed without error.
      
      	Partially parsed configurations are remembered so that they will
      be deallocated when the entire struct usb_device is freed.
      8fc9363d
    • David Brownell's avatar
      [PATCH] USB: psdocs fails for usbgadget · 94e549ea
      David Brownell authored
      It updates the "gadget" kerneldoc, removing some (new) warnings, and
      showing some fields it hadn't previously been showing (due to
      limitations in docproc).  Plus it adds a bit of information about recent
      changes (new drivers).
      94e549ea
    • Daniel Drake's avatar
      [PATCH] USB: Debug code fixes for dabusb · 2bb6f908
      Daniel Drake authored
      2bb6f908
    • Greg Kroah-Hartman's avatar
    • Alan Stern's avatar
      [PATCH] USB: Changes to core/config.c (1 of 9) · 63fc7434
      Alan Stern authored
      This first patch makes only trivial changes.  Excess whitespace at the end
      of lines is removed and return codes are altered from -1 to symbolic error
      values.  The only significant difference is that in one spot a valid
      return is changed to an error return, when a descriptor does not have the
      correct type.
      
       - Remove excess whitespace at the ends of lines.
       - Change return codes to symbolic values.
       - Return an error when an invalid endpoint descriptor is found.
      63fc7434
    • Randy Hron's avatar
      [PATCH] [PATCH] drivers/usb version/include cleanup · 134e438a
      Randy Hron authored
      Remove unneeded version.h and doubley included header.
      Test compiled on 2.6.0-test5-bk3.
      134e438a
    • Daniel Drake's avatar
      [PATCH] USB: Debug code fixes for usblp · 272818c5
      Daniel Drake authored
      When compiling usblp with debug info, a compile error occurs. I presume
      this is because this part of the code has not been updated since the 2.4
      kernels.  This patch fixes this.
      I also enhanced the debug output a little, as suggested by Randy Dunlap.
      272818c5
    • Daniel Drake's avatar
      [PATCH] USB: Debug code fixes for vicam · 596f6232
      Daniel Drake authored
      When compiling vicam with debug info, a compile error occurs. I presume
      this is because this part of the code has not been updated since the 2.4
      kernels.  This patch fixes this.
      596f6232
    • Nicolas Kaiser's avatar
      bfd458c0
    • Nicolas Kaiser's avatar
      23dcfb3a
  3. 16 Sep, 2003 11 commits
  4. 11 Sep, 2003 12 commits