linux/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 USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
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 USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
initializers.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
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 USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00
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 USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
option_ms.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
protocol.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
protocol.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
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 USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
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 usb: sierra: fix a missing check of device_create_file 2019-03-26 16:42:52 +09:00
sierra_ms.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
transport.c scsi: core: Fix scsi_get/set_resid() interface 2019-11-08 21:34:49 -05:00
transport.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
uas-detect.h uas: Always apply US_FL_NO_ATA_1X quirk to Seagate devices 2017-11-28 15:17:49 +01:00
uas.c SCSI misc on 20191130 2019-12-02 13:37:02 -08:00
unusual_alauda.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_cypress.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_datafab.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_devs.h usb-storage: Add new JMS567 revision to unusual_devs 2019-08-21 09:45:49 -07:00
unusual_ene_ub6250.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_freecom.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_isd200.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_jumpshot.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_karma.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_onetouch.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_realtek.h USB: usb-storage: Add new ID to ums-realtek 2019-06-05 11:52:42 +02:00
unusual_sddr09.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_sddr55.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_uas.h usb-storage: Disable UAS on JMicron SATA enclosure 2019-11-18 16:56:25 +01:00
unusual_usbat.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
usb.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
usb.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
usual-tables.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00