These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / usb / serial / symbolserial.c
index 6ed8044..37f3ad1 100644 (file)
@@ -60,17 +60,15 @@ static void symbol_int_callback(struct urb *urb)
 
        usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data);
 
+       /*
+        * Data from the device comes with a 1 byte header:
+        *
+        * <size of data> <data>...
+        */
        if (urb->actual_length > 1) {
-               data_length = urb->actual_length - 1;
-
-               /*
-                * Data from the device comes with a 1 byte header:
-                *
-                * <size of data>data...
-                *      This is real data to be sent to the tty layer
-                * we pretty much just ignore the size and send everything
-                * else to the tty layer.
-                */
+               data_length = data[0];
+               if (data_length > (urb->actual_length - 1))
+                       data_length = urb->actual_length - 1;
                tty_insert_flip_string(&port->port, &data[1], data_length);
                tty_flip_buffer_push(&port->port);
        } else {