Commit a1b85b3b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull USB fixes from Greg KH:
 "Here are some small USB driver fixes for reported issues for 5.5-rc2

  There's the usual gadget and xhci fixes, as well as some other
  problems that syzbot has been finding during it's fuzzing runs. Full
  details are in the shortlog.

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

* tag 'usb-5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (21 commits)
  usb: dwc3: pci: add ID for the Intel Comet Lake -H variant
  xhci: make sure interrupts are restored to correct state
  xhci: handle some XHCI_TRUST_TX_LENGTH quirks cases as default behaviour.
  xhci: Increase STS_HALT timeout in xhci_suspend()
  usb: xhci: only set D3hot for pci device
  xhci: fix USB3 device initiated resume race with roothub autosuspend
  xhci: Fix memory leak in xhci_add_in_port()
  USB: Fix incorrect DMA allocations for local memory pool drivers
  usb: gadget: fix wrong endpoint desc
  usb: dwc3: ep0: Clear started flag on completion
  usb: dwc3: gadget: Clear started flag for non-IOC
  usb: dwc3: gadget: Fix logical condition
  USB: atm: ueagle-atm: add missing endpoint check
  USB: adutux: fix interface sanity check
  USB: idmouse: fix interface sanity checks
  USB: serial: io_edgeport: fix epic endpoint lookup
  usb: mon: Fix a deadlock in usbmon between mmap and read
  usb: common: usb-conn-gpio: Don't log an error on probe deferral
  usb: core: urb: fix URB structure initialization function
  usb: typec: fix use after free in typec_register_port()
  ...
parents 81d55984 3c3caae4
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -2124,10 +2124,11 @@ resubmit:
/*
 * Start the modem : init the data and start kernel thread
 */
static int uea_boot(struct uea_softc *sc)
static int uea_boot(struct uea_softc *sc, struct usb_interface *intf)
{
	int ret, size;
	struct intr_pkt *intr;
	int ret = -ENOMEM;
	int size;

	uea_enters(INS_TO_USBDEV(sc));

@@ -2152,6 +2153,11 @@ static int uea_boot(struct uea_softc *sc)
	if (UEA_CHIP_VERSION(sc) == ADI930)
		load_XILINX_firmware(sc);

	if (intf->cur_altsetting->desc.bNumEndpoints < 1) {
		ret = -ENODEV;
		goto err0;
	}

	intr = kmalloc(size, GFP_KERNEL);
	if (!intr)
		goto err0;
@@ -2163,8 +2169,7 @@ static int uea_boot(struct uea_softc *sc)
	usb_fill_int_urb(sc->urb_int, sc->usb_dev,
			 usb_rcvintpipe(sc->usb_dev, UEA_INTR_PIPE),
			 intr, size, uea_intr, sc,
			 sc->usb_dev->actconfig->interface[0]->altsetting[0].
			 endpoint[0].desc.bInterval);
			 intf->cur_altsetting->endpoint[0].desc.bInterval);

	ret = usb_submit_urb(sc->urb_int, GFP_KERNEL);
	if (ret < 0) {
@@ -2179,6 +2184,7 @@ static int uea_boot(struct uea_softc *sc)
	sc->kthread = kthread_create(uea_kthread, sc, "ueagle-atm");
	if (IS_ERR(sc->kthread)) {
		uea_err(INS_TO_USBDEV(sc), "failed to create thread\n");
		ret = PTR_ERR(sc->kthread);
		goto err2;
	}

@@ -2193,7 +2199,7 @@ err1:
	kfree(intr);
err0:
	uea_leaves(INS_TO_USBDEV(sc));
	return -ENOMEM;
	return ret;
}

/*
@@ -2548,7 +2554,7 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
		}
	}

	ret = uea_boot(sc);
	ret = uea_boot(sc, intf);
	if (ret < 0)
		goto error;

+2 −1
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ static int usb_conn_probe(struct platform_device *pdev)

	info->vbus = devm_regulator_get(dev, "vbus");
	if (IS_ERR(info->vbus)) {
		if (PTR_ERR(info->vbus) != -EPROBE_DEFER)
			dev_err(dev, "failed to get vbus\n");
		return PTR_ERR(info->vbus);
	}
+21 −21
Original line number Diff line number Diff line
@@ -1409,7 +1409,17 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
	if (usb_endpoint_xfer_control(&urb->ep->desc)) {
		if (hcd->self.uses_pio_for_control)
			return ret;
		if (hcd_uses_dma(hcd)) {
		if (hcd->localmem_pool) {
			ret = hcd_alloc_coherent(
					urb->dev->bus, mem_flags,
					&urb->setup_dma,
					(void **)&urb->setup_packet,
					sizeof(struct usb_ctrlrequest),
					DMA_TO_DEVICE);
			if (ret)
				return ret;
			urb->transfer_flags |= URB_SETUP_MAP_LOCAL;
		} else if (hcd_uses_dma(hcd)) {
			if (object_is_on_stack(urb->setup_packet)) {
				WARN_ONCE(1, "setup packet is on stack\n");
				return -EAGAIN;
@@ -1424,23 +1434,22 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
						urb->setup_dma))
				return -EAGAIN;
			urb->transfer_flags |= URB_SETUP_MAP_SINGLE;
		} else if (hcd->localmem_pool) {
			ret = hcd_alloc_coherent(
					urb->dev->bus, mem_flags,
					&urb->setup_dma,
					(void **)&urb->setup_packet,
					sizeof(struct usb_ctrlrequest),
					DMA_TO_DEVICE);
			if (ret)
				return ret;
			urb->transfer_flags |= URB_SETUP_MAP_LOCAL;
		}
	}

	dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
	if (urb->transfer_buffer_length != 0
	    && !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)) {
		if (hcd_uses_dma(hcd)) {
		if (hcd->localmem_pool) {
			ret = hcd_alloc_coherent(
					urb->dev->bus, mem_flags,
					&urb->transfer_dma,
					&urb->transfer_buffer,
					urb->transfer_buffer_length,
					dir);
			if (ret == 0)
				urb->transfer_flags |= URB_MAP_LOCAL;
		} else if (hcd_uses_dma(hcd)) {
			if (urb->num_sgs) {
				int n;

@@ -1491,15 +1500,6 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
				else
					urb->transfer_flags |= URB_DMA_MAP_SINGLE;
			}
		} else if (hcd->localmem_pool) {
			ret = hcd_alloc_coherent(
					urb->dev->bus, mem_flags,
					&urb->transfer_dma,
					&urb->transfer_buffer,
					urb->transfer_buffer_length,
					dir);
			if (ret == 0)
				urb->transfer_flags |= URB_MAP_LOCAL;
		}
		if (ret && (urb->transfer_flags & (URB_SETUP_MAP_SINGLE |
				URB_SETUP_MAP_LOCAL)))
+1 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ void usb_init_urb(struct urb *urb)
	if (urb) {
		memset(urb, 0, sizeof(*urb));
		kref_init(&urb->kref);
		INIT_LIST_HEAD(&urb->urb_list);
		INIT_LIST_HEAD(&urb->anchor_list);
	}
}
+5 −1
Original line number Diff line number Diff line
@@ -29,7 +29,8 @@
#define PCI_DEVICE_ID_INTEL_BXT_M		0x1aaa
#define PCI_DEVICE_ID_INTEL_APL			0x5aaa
#define PCI_DEVICE_ID_INTEL_KBP			0xa2b0
#define PCI_DEVICE_ID_INTEL_CMLH		0x02ee
#define PCI_DEVICE_ID_INTEL_CMLLP		0x02ee
#define PCI_DEVICE_ID_INTEL_CMLH		0x06ee
#define PCI_DEVICE_ID_INTEL_GLK			0x31aa
#define PCI_DEVICE_ID_INTEL_CNPLP		0x9dee
#define PCI_DEVICE_ID_INTEL_CNPH		0xa36e
@@ -308,6 +309,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
	  (kernel_ulong_t) &dwc3_pci_mrfld_properties, },

	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLLP),
	  (kernel_ulong_t) &dwc3_pci_intel_properties, },

	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLH),
	  (kernel_ulong_t) &dwc3_pci_intel_properties, },

Loading