Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "USB: serial: make bulk_out_size a lower limit"

This reverts commit 5083fd7bdfe6760577235a724cf6dccae13652c2.

A bulk-out size smaller than the end-point size is indeed valid. The
offending commit broke the usb-debug driver for EHCI debug devices,
which use 8-byte buffers.

Fixes: 5083fd7bdfe6 ("USB: serial: make bulk_out_size a lower limit")
Reported-by: "Li, Elvin" <elvin.li@intel.com>
Cc: stable <stable@vger.kernel.org> # v3.15
Signed-off-by: Johan Hovold <johan@kernel.org>

+4 -4
+3 -2
drivers/usb/serial/usb-serial.c
··· 940 940 port = serial->port[i]; 941 941 if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL)) 942 942 goto probe_error; 943 - buffer_size = max_t(int, serial->type->bulk_out_size, 944 - usb_endpoint_maxp(endpoint)); 943 + buffer_size = serial->type->bulk_out_size; 944 + if (!buffer_size) 945 + buffer_size = usb_endpoint_maxp(endpoint); 945 946 port->bulk_out_size = buffer_size; 946 947 port->bulk_out_endpointAddress = endpoint->bEndpointAddress; 947 948
+1 -2
include/linux/usb/serial.h
··· 190 190 * @num_ports: the number of different ports this device will have. 191 191 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer 192 192 * (0 = end-point size) 193 - * @bulk_out_size: minimum number of bytes to allocate for bulk-out buffer 194 - * (0 = end-point size) 193 + * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) 195 194 * @calc_num_ports: pointer to a function to determine how many ports this 196 195 * device has dynamically. It will be called after the probe() 197 196 * callback is called, but before attach()