linux-stable/drivers/usb/storage
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
..
alauda.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
cypress_atacb.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
datafab.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
debug.c
debug.h usb-storage: remove single-use define for debugging 2019-09-10 10:30:53 +02:00
ene_ub6250.c scsi: core: Fix scsi_get/set_resid() interface 2019-11-08 21:34:49 -05:00
freecom.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
initializers.c
initializers.h
isd200.c Modules updates for v5.4 2019-09-22 10:34:46 -07:00
jumpshot.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
karma.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
Kconfig
Makefile usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
onetouch.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
option_ms.c
option_ms.h
protocol.c
protocol.h
realtek_cr.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
scsiglue.c USB: Fix incorrect DMA allocations for local memory pool drivers 2019-12-11 09:06:41 +01:00
scsiglue.h
sddr09.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
sddr55.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
shuttle_usbat.c usb-storage: export symbols in USB_STORAGE namespace 2019-09-10 10:30:57 +02:00
sierra_ms.c
sierra_ms.h
transport.c scsi: core: Fix scsi_get/set_resid() interface 2019-11-08 21:34:49 -05:00
transport.h
uas-detect.h
uas.c SCSI misc on 20191130 2019-12-02 13:37:02 -08:00
unusual_alauda.h
unusual_cypress.h
unusual_datafab.h
unusual_devs.h usb-storage: Add new JMS567 revision to unusual_devs 2019-08-21 09:45:49 -07:00
unusual_ene_ub6250.h
unusual_freecom.h
unusual_isd200.h
unusual_jumpshot.h
unusual_karma.h
unusual_onetouch.h
unusual_realtek.h USB: usb-storage: Add new ID to ums-realtek 2019-06-05 11:52:42 +02:00
unusual_sddr09.h
unusual_sddr55.h
unusual_uas.h usb-storage: Disable UAS on JMicron SATA enclosure 2019-11-18 16:56:25 +01:00
unusual_usbat.h
usb.c
usb.h
usual-tables.c