alistair23-linux/drivers/usb/core
Fredrik Noring f8c63edfd7 USB: Fix incorrect DMA allocations for local memory pool drivers
Fix commit 7b81cb6bdd ("usb: add a HCD_DMA flag instead of
guestimating DMA capabilities") where local memory USB drivers
erroneously allocate DMA memory instead of pool memory, causing

	OHCI Unrecoverable Error, disabled
	HC died; cleaning up

The order between hcd_uses_dma() and hcd->localmem_pool is now
arranged as in hcd_buffer_alloc() and hcd_buffer_free(), with the
test for hcd->localmem_pool placed first.

As an alternative, one might consider adjusting hcd_uses_dma() with

 static inline bool hcd_uses_dma(struct usb_hcd *hcd)
 {
-	return IS_ENABLED(CONFIG_HAS_DMA) && (hcd->driver->flags & HCD_DMA);
+	return IS_ENABLED(CONFIG_HAS_DMA) &&
+		(hcd->driver->flags & HCD_DMA) &&
+		(hcd->localmem_pool == NULL);
 }

One can also consider unsetting HCD_DMA for local memory pool drivers.

Fixes: 7b81cb6bdd ("usb: add a HCD_DMA flag instead of guestimating DMA capabilities")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
Link: https://lore.kernel.org/r/20191210172905.GA52526@sx9
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-11 09:06:41 +01:00
..
buffer.c usb: add a hcd_uses_dma helper 2019-08-15 15:18:05 +02:00
config.c Merge 5.4-rc6 into usb-next 2019-11-04 06:41:09 +01:00
devices.c
devio.c compat_ioctl: remove most of fs/compat_ioctl.c 2019-12-01 13:46:15 -08:00
driver.c USB: add support for dev_groups to struct usb_device_driver 2019-08-07 14:05:04 +02:00
endpoint.c
file.c USB: core: Fix races in character device registration and deregistraion 2019-08-12 22:47:24 +02:00
generic.c usbfs: Add ioctls for runtime power management 2019-08-09 07:55:45 +02:00
hcd-pci.c PCI: Add PCI_STD_NUM_BARS for the number of standard BARs 2019-10-14 10:22:26 -05:00
hcd.c USB: Fix incorrect DMA allocations for local memory pool drivers 2019-12-11 09:06:41 +01:00
hub.c usb, kcov: collect coverage from hub_event 2019-12-04 19:44:14 -08:00
hub.h
Kconfig usb: remove redundant 'default n' from Kconfig-s 2019-05-21 10:06:22 +02:00
ledtrig-usbport.c
Makefile
message.c USB: CDC: fix sanity checks in CDC union parser 2019-08-15 14:49:16 +02:00
notify.c USB: core: Remove usbfs_mutex 2019-06-26 10:28:09 +08:00
of.c
otg_whitelist.h
phy.c usb: core: phy: add support for PHY calibration 2019-09-03 15:54:55 +02:00
phy.h usb: core: phy: add support for PHY calibration 2019-09-03 15:54:55 +02:00
port.c USB: Disable USB2 LPM at shutdown 2019-08-05 17:19:46 +02:00
quirks.c USB: Fix chipmunk-like voice when using Logitech C270 for recording audio. 2019-06-05 11:52:42 +02:00
sysfs.c usb: setup authorized_default attributes using usb_bus_notify 2019-08-08 16:07:34 +02:00
urb.c usb: core: urb: fix URB structure initialization function 2019-12-10 11:41:19 +01:00
usb-acpi.c
usb.c usb: remove commented out dma wrappers 2019-09-03 15:26:12 +02:00
usb.h Merge 5.3-rc4 into usb-next 2019-08-12 07:42:51 +02:00