USB-serial fixes for v4.12-rc2

Here's a fix for a long-standing issue in the ftdi_sio driver that
 prevented unprivileged users from updating the low-latency flag,
 something which became apparent after a recent change that restored the
 older setting of not using low-latency mode by default.
 
 A run of sparse revealed a couple of endianness issues that are now
 fixed, and addressed is also a user-triggerable division-by-zero in
 io_ti when debugging is enabled.
 
 Finally there are some new device ids, including a simplification of how
 we deal with a couple of older Olimex JTAG adapters.
 
 All have been in linux-next with no reported issues.
 
 Signed-off-by: Johan Hovold <johan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEHszNKQClByu0A+9RQQ3kT97htJUFAlkeotERHGpvaGFuQGtl
 cm5lbC5vcmcACgkQQQ3kT97htJX75xAAsQA0i+Bbafh5zfWyrz5Y5a+jaS6S5ilp
 LMiZnBlqRXkfRHzCB8loUn+EJuFWp4TAr07FypRHPuocDmIkTQ8vx949rmB9mN51
 oGBvmCREhoawBB7Mvh19ZMgzT/4GR4Nhg9RINJDtjsAj442Twn3MVwNQWFx2i9Vj
 Vr6mRy03XxaN8/I/CnHXfYhRvH/zKB2MfCO0GqvoRFQOO2cjjS4Ebwl6KMySr/ok
 Vu1loIsNl7dpxro8tlfJ30u7mOcD72Yg5nD8ED+caEerIaTpeOJl9rjVk/TFVPpq
 Yk2fGU43TvPkj+aNMsXw9PvWBGQwmIxgiohQ4ivKAiCHeQYyHC0EqktqBf+Ru0NR
 LbYztpvlO0I0gHIt2l3uf0ZbsPy05Fi9HyknX/4DUXstaFwOvNzksPNe8E4M0ELX
 mcMSENa6D/FIAZjnxBpssqHaTovCeS355oUE6z8yb/fy3sAFraUwj0BHqV9aXjtr
 XQf8ZaGFWuc61KnezSoIhWVSBxq3aFsazEHP1yZbOoNxDIAg+bjklmees17Y9uDa
 w3KGQUX7+MWc8Ccfp2QEeRnIsqq1O9r22WTL2Q1W3nkP3y90i9QiruZZ/UhxPWsz
 rhgL0ygyNAIRzyfV9fFTxPQiD5IeSnYElZXv7sjQHAARNGzkNVA7YYeKqA2mPw7e
 vNXKKToyERg=
 =psyq
 -----END PGP SIGNATURE-----

Merge tag 'usb-serial-4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus

Johan writes:

USB-serial fixes for v4.12-rc2

Here's a fix for a long-standing issue in the ftdi_sio driver that
prevented unprivileged users from updating the low-latency flag,
something which became apparent after a recent change that restored the
older setting of not using low-latency mode by default.

A run of sparse revealed a couple of endianness issues that are now
fixed, and addressed is also a user-triggerable division-by-zero in
io_ti when debugging is enabled.

Finally there are some new device ids, including a simplification of how
we deal with a couple of older Olimex JTAG adapters.

All have been in linux-next with no reported issues.

Signed-off-by: Johan Hovold <johan@kernel.org>
This commit is contained in:
Greg Kroah-Hartman 2017-05-19 10:10:07 +02:00
commit b51e0ceed1
7 changed files with 34 additions and 16 deletions

View File

@ -809,10 +809,10 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) },
{ USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID),
.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
{ USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID),
.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
{ USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID),
.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
{ USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID, 1) },
{ USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID, 1) },
{ USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_TINY_PID, 1) },
{ USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_TINY_H_PID, 1) },
{ USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID),
.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
{ USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID),
@ -1527,9 +1527,9 @@ static int set_serial_info(struct tty_struct *tty,
(new_serial.flags & ASYNC_FLAGS));
priv->custom_divisor = new_serial.custom_divisor;
check_and_exit:
write_latency_timer(port);
check_and_exit:
if ((old_priv.flags & ASYNC_SPD_MASK) !=
(priv->flags & ASYNC_SPD_MASK)) {
if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)

View File

@ -882,6 +882,8 @@
/* Olimex */
#define OLIMEX_VID 0x15BA
#define OLIMEX_ARM_USB_OCD_PID 0x0003
#define OLIMEX_ARM_USB_TINY_PID 0x0004
#define OLIMEX_ARM_USB_TINY_H_PID 0x002a
#define OLIMEX_ARM_USB_OCD_H_PID 0x002b
/*

View File

@ -2336,8 +2336,11 @@ static void change_port_settings(struct tty_struct *tty,
if (!baud) {
/* pick a default, any default... */
baud = 9600;
} else
} else {
/* Avoid a zero divisor. */
baud = min(baud, 461550);
tty_encode_baud_rate(tty, baud, baud);
}
edge_port->baud_rate = baud;
config->wBaudRate = (__u16)((461550L + baud/2) / baud);

View File

@ -197,6 +197,7 @@ static u8 ir_xbof_change(u8 xbof)
static int ir_startup(struct usb_serial *serial)
{
struct usb_irda_cs_descriptor *irda_desc;
int rates;
irda_desc = irda_usb_find_class_desc(serial, 0);
if (!irda_desc) {
@ -205,18 +206,20 @@ static int ir_startup(struct usb_serial *serial)
return -ENODEV;
}
rates = le16_to_cpu(irda_desc->wBaudRate);
dev_dbg(&serial->dev->dev,
"%s - Baud rates supported:%s%s%s%s%s%s%s%s%s\n",
__func__,
(irda_desc->wBaudRate & USB_IRDA_BR_2400) ? " 2400" : "",
(irda_desc->wBaudRate & USB_IRDA_BR_9600) ? " 9600" : "",
(irda_desc->wBaudRate & USB_IRDA_BR_19200) ? " 19200" : "",
(irda_desc->wBaudRate & USB_IRDA_BR_38400) ? " 38400" : "",
(irda_desc->wBaudRate & USB_IRDA_BR_57600) ? " 57600" : "",
(irda_desc->wBaudRate & USB_IRDA_BR_115200) ? " 115200" : "",
(irda_desc->wBaudRate & USB_IRDA_BR_576000) ? " 576000" : "",
(irda_desc->wBaudRate & USB_IRDA_BR_1152000) ? " 1152000" : "",
(irda_desc->wBaudRate & USB_IRDA_BR_4000000) ? " 4000000" : "");
(rates & USB_IRDA_BR_2400) ? " 2400" : "",
(rates & USB_IRDA_BR_9600) ? " 9600" : "",
(rates & USB_IRDA_BR_19200) ? " 19200" : "",
(rates & USB_IRDA_BR_38400) ? " 38400" : "",
(rates & USB_IRDA_BR_57600) ? " 57600" : "",
(rates & USB_IRDA_BR_115200) ? " 115200" : "",
(rates & USB_IRDA_BR_576000) ? " 576000" : "",
(rates & USB_IRDA_BR_1152000) ? " 1152000" : "",
(rates & USB_IRDA_BR_4000000) ? " 4000000" : "");
switch (irda_desc->bmAdditionalBOFs) {
case USB_IRDA_AB_48:

View File

@ -189,7 +189,7 @@ static int mct_u232_set_baud_rate(struct tty_struct *tty,
return -ENOMEM;
divisor = mct_u232_calculate_baud_rate(serial, value, &speed);
put_unaligned_le32(cpu_to_le32(divisor), buf);
put_unaligned_le32(divisor, buf);
rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
MCT_U232_SET_BAUD_RATE_REQUEST,
MCT_U232_SET_REQUEST_TYPE,

View File

@ -281,6 +281,7 @@ static void option_instat_callback(struct urb *urb);
#define TELIT_PRODUCT_LE922_USBCFG0 0x1042
#define TELIT_PRODUCT_LE922_USBCFG3 0x1043
#define TELIT_PRODUCT_LE922_USBCFG5 0x1045
#define TELIT_PRODUCT_ME910 0x1100
#define TELIT_PRODUCT_LE920 0x1200
#define TELIT_PRODUCT_LE910 0x1201
#define TELIT_PRODUCT_LE910_USBCFG4 0x1206
@ -640,6 +641,11 @@ static const struct option_blacklist_info simcom_sim7100e_blacklist = {
.reserved = BIT(5) | BIT(6),
};
static const struct option_blacklist_info telit_me910_blacklist = {
.sendsetup = BIT(0),
.reserved = BIT(1) | BIT(3),
};
static const struct option_blacklist_info telit_le910_blacklist = {
.sendsetup = BIT(0),
.reserved = BIT(1) | BIT(2),
@ -1235,6 +1241,8 @@ static const struct usb_device_id option_ids[] = {
.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG5, 0xff),
.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910),
.driver_info = (kernel_ulong_t)&telit_me910_blacklist },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
.driver_info = (kernel_ulong_t)&telit_le910_blacklist },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),

View File

@ -162,6 +162,8 @@ static const struct usb_device_id id_table[] = {
{DEVICE_SWI(0x1199, 0x9071)}, /* Sierra Wireless MC74xx */
{DEVICE_SWI(0x1199, 0x9078)}, /* Sierra Wireless EM74xx */
{DEVICE_SWI(0x1199, 0x9079)}, /* Sierra Wireless EM74xx */
{DEVICE_SWI(0x1199, 0x907a)}, /* Sierra Wireless EM74xx QDL */
{DEVICE_SWI(0x1199, 0x907b)}, /* Sierra Wireless EM74xx */
{DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */
{DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */
{DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */