linux/drivers/usb
Alan Stern 546aa0e4ea usb-storage: Add quirk to defeat Kindle's automatic unload
Matthias reports that the Amazon Kindle automatically removes its
emulated media if it doesn't receive another SCSI command within about
one second after a SYNCHRONIZE CACHE.  It does so even when the host
has sent a PREVENT MEDIUM REMOVAL command.  The reason for this
behavior isn't clear, although it's not hard to make some guesses.

At any rate, the results can be unexpected for anyone who tries to
access the Kindle in an unusual fashion, and in theory they can lead
to data loss (for example, if one file is closed and synchronized
while other files are still in the middle of being written).

To avoid such problems, this patch creates a new usb-storage quirks
flag telling the driver always to issue a REQUEST SENSE following a
SYNCHRONIZE CACHE command, and adds an unusual_devs entry for the
Kindle with the flag set.  This is sufficient to prevent the Kindle
from doing its automatic unload, without interfering with proper
operation.

Another possible way to deal with this would be to increase the
frequency of TEST UNIT READY polling that the kernel normally carries
out for removable-media storage devices.  However that would increase
the overall load on the system and it is not as reliable, because the
user can override the polling interval.  Changing the driver's
behavior is safer and has minimal overhead.

CC: <stable@vger.kernel.org>
Reported-and-tested-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20210317190654.GA497856@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-17 21:30:15 +01:00
..
atm drivers: usb: atm: use pr_err() and pr_warn() instead of raw printk() 2020-12-09 15:22:51 +01:00
c67x00 usb/c67x00: Replace tasklet with work 2021-01-26 18:36:37 +01:00
cdns3 usb: cdnsp: Fixes incorrect value in ISOC TRB 2021-03-13 22:03:24 +08:00
chipidea usb: chipidea: tegra: Specify TX FIFO threshold in UDC SoC info 2021-01-13 11:26:34 +01:00
class USB: usblp: fix a hang in poll() if disconnected 2021-03-10 09:36:13 +01:00
common usb: common: Parse for USB SSP genXxY 2021-02-06 14:21:21 +01:00
core drm: Use USB controller's DMA mask when importing dmabufs 2021-03-11 11:11:33 +01:00
dwc2 Merge 5.11-rc7 into usb-next 2021-02-08 09:09:27 +01:00
dwc3 usb: dwc3: qcom: Add missing DWC3 OF node refcount decrement 2021-03-10 09:36:13 +01:00
early usb: early: ehci-dbgp: convert to readl_poll_timeout_atomic() 2020-09-25 16:29:09 +02:00
gadget usb: gadget: configfs: Fix KASAN use-after-free 2021-03-17 21:29:46 +01:00
host xhci: Fix repeated xhci wake after suspend due to uncleared internal wake state 2021-03-11 13:03:06 +01:00
image USB: microtek: use set_host_byte() 2020-09-16 12:42:10 +02:00
isp1760 usb: isp1760-hcd: convert to readl_poll_timeout_atomic() 2020-09-25 16:30:05 +02:00
misc Devicetree updates for v5.12: 2021-02-22 10:05:12 -08:00
mon
mtu3 usb: mtu3: fix memory corruption in mtu3_debugfs_regset() 2020-12-07 15:26:18 +01:00
musb usb: musb: jz4740: Add missing CR to error strings 2021-02-05 10:27:18 +01:00
phy usb: phy: phy-mxs-usb: Use of_device_get_match_data() 2021-01-18 18:35:46 +01:00
renesas_usbhs usb: renesas_usbhs: Clear PIPECFG for re-enabling pipe with other EPNUM 2021-03-10 09:36:13 +01:00
roles device connection: Remove struct device_connection 2020-09-07 11:14:09 +02:00
serial USB: serial: io_edgeport: fix memory leak in edge_startup 2021-03-09 09:05:37 +01:00
storage usb-storage: Add quirk to defeat Kindle's automatic unload 2021-03-17 21:30:15 +01:00
typec usb: typec: tcpm: Get Sink VDO from fwnode 2021-02-09 11:48:55 +01:00
usbip usbip: Fix incorrect double assignment to udc->ud.tcp_rx 2021-03-17 21:27:48 +01:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver 2020-12-29 12:36:13 +08:00
usb-skeleton.c