]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
uas: Fix bounds check in uas_find_endpoints
authorHans de Goede <hdegoede@redhat.com>
Tue, 29 Oct 2013 08:06:54 +0000 (09:06 +0100)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Tue, 4 Mar 2014 23:38:18 +0000 (15:38 -0800)
The loop uses up to 3 bytes of the endpoint extra data.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
drivers/usb/storage/uas.c

index 1ac66f290fbf7db62e49c61be96c6016638deb95..7662b3e13c4dc305e64fc7d93360b00fff59f1cf 100644 (file)
@@ -907,7 +907,7 @@ static int uas_find_endpoints(struct usb_host_interface *alt,
        for (i = 0; i < n_endpoints; i++) {
                unsigned char *extra = endpoint[i].extra;
                int len = endpoint[i].extralen;
-               while (len > 1) {
+               while (len >= 3) {
                        if (extra[1] == USB_DT_PIPE_USAGE) {
                                unsigned pipe_id = extra[2];
                                if (pipe_id > 0 && pipe_id < 5)