Commit 24d5b287 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'usb-4.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are a number of small USB fixes for 4.18-rc5.

  Nothing major here, just the normal set of new device ids, xhci fixes,
  and some typec fixes. The typec fix required some tiny changes in an
  i2c driver, which that maintainer acked to come through my tree.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'usb-4.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  USB: yurex: fix out-of-bounds uaccess in read handler
  usb: quirks: add delay quirks for Corsair Strafe
  xhci: xhci-mem: off by one in xhci_stream_id_to_ring()
  usb/gadget: aspeed-vhub: add USB_LIBCOMPOSITE dependency
  docs: kernel-parameters.txt: document xhci-hcd.quirks parameter
  USB: serial: mos7840: fix status-register error handling
  USB: serial: keyspan_pda: fix modem-status error handling
  USB: serial: cp210x: add another USB ID for Qivicon ZigBee stick
  USB: serial: ch341: fix type promotion bug in ch341_control_in()
  i2c-cht-wc: Fix bq24190 supplier
  typec: tcpm: Correctly report power_supply current and voltage for non pd supply
  usb: xhci: dbc: Don't decrement runtime PM counter if DBC is not started
parents f1454959 f1e255d6
...@@ -4846,3 +4846,8 @@ ...@@ -4846,3 +4846,8 @@
xirc2ps_cs= [NET,PCMCIA] xirc2ps_cs= [NET,PCMCIA]
Format: Format:
<irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]] <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
xhci-hcd.quirks [USB,KNL]
A hex value specifying bitmask with supplemental xhci
host controller quirks. Meaning of each bit can be
consulted in header drivers/usb/host/xhci.h.
...@@ -234,7 +234,8 @@ static const struct irq_chip cht_wc_i2c_irq_chip = { ...@@ -234,7 +234,8 @@ static const struct irq_chip cht_wc_i2c_irq_chip = {
.name = "cht_wc_ext_chrg_irq_chip", .name = "cht_wc_ext_chrg_irq_chip",
}; };
static const char * const bq24190_suppliers[] = { "fusb302-typec-source" }; static const char * const bq24190_suppliers[] = {
"tcpm-source-psy-i2c-fusb302" };
static const struct property_entry bq24190_props[] = { static const struct property_entry bq24190_props[] = {
PROPERTY_ENTRY_STRING_ARRAY("supplied-from", bq24190_suppliers), PROPERTY_ENTRY_STRING_ARRAY("supplied-from", bq24190_suppliers),
......
...@@ -378,6 +378,10 @@ static const struct usb_device_id usb_quirk_list[] = { ...@@ -378,6 +378,10 @@ static const struct usb_device_id usb_quirk_list[] = {
/* Corsair K70 RGB */ /* Corsair K70 RGB */
{ USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT }, { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
/* Corsair Strafe */
{ USB_DEVICE(0x1b1c, 0x1b15), .driver_info = USB_QUIRK_DELAY_INIT |
USB_QUIRK_DELAY_CTRL_MSG },
/* Corsair Strafe RGB */ /* Corsair Strafe RGB */
{ USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT | { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT |
USB_QUIRK_DELAY_CTRL_MSG }, USB_QUIRK_DELAY_CTRL_MSG },
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
config USB_ASPEED_VHUB config USB_ASPEED_VHUB
tristate "Aspeed vHub UDC driver" tristate "Aspeed vHub UDC driver"
depends on ARCH_ASPEED || COMPILE_TEST depends on ARCH_ASPEED || COMPILE_TEST
depends on USB_LIBCOMPOSITE
help help
USB peripheral controller for the Aspeed AST2500 family USB peripheral controller for the Aspeed AST2500 family
SoCs supporting the "vHub" functionality and USB2.0 SoCs supporting the "vHub" functionality and USB2.0
...@@ -508,16 +508,18 @@ static int xhci_do_dbc_start(struct xhci_hcd *xhci) ...@@ -508,16 +508,18 @@ static int xhci_do_dbc_start(struct xhci_hcd *xhci)
return 0; return 0;
} }
static void xhci_do_dbc_stop(struct xhci_hcd *xhci) static int xhci_do_dbc_stop(struct xhci_hcd *xhci)
{ {
struct xhci_dbc *dbc = xhci->dbc; struct xhci_dbc *dbc = xhci->dbc;
if (dbc->state == DS_DISABLED) if (dbc->state == DS_DISABLED)
return; return -1;
writel(0, &dbc->regs->control); writel(0, &dbc->regs->control);
xhci_dbc_mem_cleanup(xhci); xhci_dbc_mem_cleanup(xhci);
dbc->state = DS_DISABLED; dbc->state = DS_DISABLED;
return 0;
} }
static int xhci_dbc_start(struct xhci_hcd *xhci) static int xhci_dbc_start(struct xhci_hcd *xhci)
...@@ -544,6 +546,7 @@ static int xhci_dbc_start(struct xhci_hcd *xhci) ...@@ -544,6 +546,7 @@ static int xhci_dbc_start(struct xhci_hcd *xhci)
static void xhci_dbc_stop(struct xhci_hcd *xhci) static void xhci_dbc_stop(struct xhci_hcd *xhci)
{ {
int ret;
unsigned long flags; unsigned long flags;
struct xhci_dbc *dbc = xhci->dbc; struct xhci_dbc *dbc = xhci->dbc;
struct dbc_port *port = &dbc->port; struct dbc_port *port = &dbc->port;
...@@ -556,10 +559,11 @@ static void xhci_dbc_stop(struct xhci_hcd *xhci) ...@@ -556,10 +559,11 @@ static void xhci_dbc_stop(struct xhci_hcd *xhci)
xhci_dbc_tty_unregister_device(xhci); xhci_dbc_tty_unregister_device(xhci);
spin_lock_irqsave(&dbc->lock, flags); spin_lock_irqsave(&dbc->lock, flags);
xhci_do_dbc_stop(xhci); ret = xhci_do_dbc_stop(xhci);
spin_unlock_irqrestore(&dbc->lock, flags); spin_unlock_irqrestore(&dbc->lock, flags);
pm_runtime_put_sync(xhci_to_hcd(xhci)->self.controller); if (!ret)
pm_runtime_put_sync(xhci_to_hcd(xhci)->self.controller);
} }
static void static void
......
...@@ -595,7 +595,7 @@ struct xhci_ring *xhci_stream_id_to_ring( ...@@ -595,7 +595,7 @@ struct xhci_ring *xhci_stream_id_to_ring(
if (!ep->stream_info) if (!ep->stream_info)
return NULL; return NULL;
if (stream_id > ep->stream_info->num_streams) if (stream_id >= ep->stream_info->num_streams)
return NULL; return NULL;
return ep->stream_info->stream_rings[stream_id]; return ep->stream_info->stream_rings[stream_id];
} }
......
...@@ -396,8 +396,7 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count, ...@@ -396,8 +396,7 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
struct usb_yurex *dev; struct usb_yurex *dev;
int retval = 0; int len = 0;
int bytes_read = 0;
char in_buffer[20]; char in_buffer[20];
unsigned long flags; unsigned long flags;
...@@ -405,26 +404,16 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count, ...@@ -405,26 +404,16 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
mutex_lock(&dev->io_mutex); mutex_lock(&dev->io_mutex);
if (!dev->interface) { /* already disconnected */ if (!dev->interface) { /* already disconnected */
retval = -ENODEV; mutex_unlock(&dev->io_mutex);
goto exit; return -ENODEV;
} }
spin_lock_irqsave(&dev->lock, flags); spin_lock_irqsave(&dev->lock, flags);
bytes_read = snprintf(in_buffer, 20, "%lld\n", dev->bbu); len = snprintf(in_buffer, 20, "%lld\n", dev->bbu);
spin_unlock_irqrestore(&dev->lock, flags); spin_unlock_irqrestore(&dev->lock, flags);
if (*ppos < bytes_read) {
if (copy_to_user(buffer, in_buffer + *ppos, bytes_read - *ppos))
retval = -EFAULT;
else {
retval = bytes_read - *ppos;
*ppos += bytes_read;
}
}
exit:
mutex_unlock(&dev->io_mutex); mutex_unlock(&dev->io_mutex);
return retval;
return simple_read_from_buffer(buffer, count, ppos, in_buffer, len);
} }
static ssize_t yurex_write(struct file *file, const char __user *user_buffer, static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
......
...@@ -128,7 +128,7 @@ static int ch341_control_in(struct usb_device *dev, ...@@ -128,7 +128,7 @@ static int ch341_control_in(struct usb_device *dev,
r = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request, r = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
value, index, buf, bufsize, DEFAULT_TIMEOUT); value, index, buf, bufsize, DEFAULT_TIMEOUT);
if (r < bufsize) { if (r < (int)bufsize) {
if (r >= 0) { if (r >= 0) {
dev_err(&dev->dev, dev_err(&dev->dev,
"short control message received (%d < %u)\n", "short control message received (%d < %u)\n",
......
...@@ -149,6 +149,7 @@ static const struct usb_device_id id_table[] = { ...@@ -149,6 +149,7 @@ static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */
{ USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */
{ USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */ { USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */
{ USB_DEVICE(0x10C4, 0x89FB) }, /* Qivicon ZigBee USB Radio Stick */
{ USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
{ USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */ { USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */
{ USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */ { USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */
......
...@@ -369,8 +369,10 @@ static int keyspan_pda_get_modem_info(struct usb_serial *serial, ...@@ -369,8 +369,10 @@ static int keyspan_pda_get_modem_info(struct usb_serial *serial,
3, /* get pins */ 3, /* get pins */
USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN, USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN,
0, 0, data, 1, 2000); 0, 0, data, 1, 2000);
if (rc >= 0) if (rc == 1)
*value = *data; *value = *data;
else if (rc >= 0)
rc = -EIO;
kfree(data); kfree(data);
return rc; return rc;
......
...@@ -468,6 +468,9 @@ static void mos7840_control_callback(struct urb *urb) ...@@ -468,6 +468,9 @@ static void mos7840_control_callback(struct urb *urb)
} }
dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length);
if (urb->actual_length < 1)
goto out;
dev_dbg(dev, "%s mos7840_port->MsrLsr is %d port %d\n", __func__, dev_dbg(dev, "%s mos7840_port->MsrLsr is %d port %d\n", __func__,
mos7840_port->MsrLsr, mos7840_port->port_num); mos7840_port->MsrLsr, mos7840_port->port_num);
data = urb->transfer_buffer; data = urb->transfer_buffer;
......
...@@ -725,6 +725,9 @@ static int tcpm_set_current_limit(struct tcpm_port *port, u32 max_ma, u32 mv) ...@@ -725,6 +725,9 @@ static int tcpm_set_current_limit(struct tcpm_port *port, u32 max_ma, u32 mv)
tcpm_log(port, "Setting voltage/current limit %u mV %u mA", mv, max_ma); tcpm_log(port, "Setting voltage/current limit %u mV %u mA", mv, max_ma);
port->supply_voltage = mv;
port->current_limit = max_ma;
if (port->tcpc->set_current_limit) if (port->tcpc->set_current_limit)
ret = port->tcpc->set_current_limit(port->tcpc, max_ma, mv); ret = port->tcpc->set_current_limit(port->tcpc, max_ma, mv);
...@@ -2595,8 +2598,6 @@ static void tcpm_reset_port(struct tcpm_port *port) ...@@ -2595,8 +2598,6 @@ static void tcpm_reset_port(struct tcpm_port *port)
tcpm_set_attached_state(port, false); tcpm_set_attached_state(port, false);
port->try_src_count = 0; port->try_src_count = 0;
port->try_snk_count = 0; port->try_snk_count = 0;
port->supply_voltage = 0;
port->current_limit = 0;
port->usb_type = POWER_SUPPLY_USB_TYPE_C; port->usb_type = POWER_SUPPLY_USB_TYPE_C;
power_supply_changed(port->psy); power_supply_changed(port->psy);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment