usb-storage: 14cd:1212 returns incorrect data after large READ(10)
Hello,
I would like to report a deterministic silent read corruption issue with 14cd:1212 USB microSD readers and propose adding a MAX_SECTORS_64 quirk.
A READ(10) larger than 64 KiB can cause the following READ(10) to return
data from the wrong LBA. The trigger I have found is that the second
read starts 64 KiB beyond the end of the first read. Instead of honoring
that gap, the reader returns data starting at the end of the first read,
that is exactly 64 KiB before the requested address. Both commands complete successfully, but the returned payload contains erroneous data.
The same problem is observed on 3 physically separate readers purchased from 2 different OEMs, all identifying as 14cd:1212 and with the same serial.
Device and environments
-----------------------
VID:PID: 14cd:1212 idVendor: Super Top idProduct: microSD card reader (SY-T18) bcdDevice: 1.00 iManufacturer: Generic iProduct: Mass Storage Device iSerial: 121220160204 speed: USB 2.0 high speed driver: usb-storage logical blocks: 512 bytes
The error is reproduced on an arm64 machine running 6.18.54 kernel, the same machine running a 6.12.112 kernel, and an amd64 machine running 6.8.0 kernel, and is confirmed directly using libusb.
This has been observed to cause data silent data corrupting when mounting an ext4 partition from the device, and setting max_sectors_kb=64 as a workaround fixes it completely.
Would adding a US_FL_MAX_SECTORS_64 quirk be appropriate? I retest against the latest mainline if needed.
Regards,
Xuntao Chi
Quoted 34 lines · Xuntao Chi
Hello,
I would like to report a deterministic silent read corruption issue with 14cd:1212 USB microSD readers and propose adding a
MAX_SECTORS_64quirk.A READ(10) larger than 64 KiB can cause the following READ(10) to return data from the wrong LBA. The trigger I have found is that the second read starts 64 KiB beyond the end of the first read. Instead of honoring that gap, the reader returns data starting at the end of the first read, that is exactly 64 KiB before the requested address. Both commands complete successfully, but the returned payload contains erroneous data.
The same problem is observed on 3 physically separate readers purchased from 2 different OEMs, all identifying as 14cd:1212 and with the same serial.
Device and environments
-----------------------VID:PID: 14cd:1212 idVendor: Super Top idProduct: microSD card reader (SY-T18) bcdDevice: 1.00 iManufacturer: Generic iProduct: Mass Storage Device iSerial: 121220160204 speed: USB 2.0 high speed driver: usb-storage logical blocks: 512 bytesThe error is reproduced on an arm64 machine running 6.18.54 kernel, the same machine running a 6.12.112 kernel, and an amd64 machine running 6.8.0 kernel, and is confirmed directly using libusb.
Quoted 6 lines
This has been observed to cause data silent data corrupting when mounting an ext4 partition from the device, and setting max_sectors_kb=64 as a workaround fixes it completely.
Would adding a
US_FL_MAX_SECTORS_64quirk be appropriate? I retest against the latest mainline if needed.
Yes, that quirk would certainly be appropriate if it fixes the problem.
Note that you can test it with no changes to the kernel, by specifying the appropriate "quirks" module parameter for usb-storage. For example, before plugging in the device, do:
echo 14cd:1212:m >/sys/module/usb_storage/parameters/quirks
Alan Stern
Quoted 1 line · Alan Stern
echo 14cd:1212:m >/sys/module/usb_storage/parameters/quirks
Can confirm that fixes the problem.
Regards,
Xuntao Chi
Quoted 4 lines · Xuntao Chi
Quoted 1 line · Alan Stern
echo 14cd:1212:m >/sys/module/usb_storage/parameters/quirksCan confirm that fixes the problem.
Okay, good. A patch to add a permanent unusual_devs entry would be welcome.
Alan Stern