• S
    usb/uas: make sure data urb is gone if we receive status before that · e4d8318a
    Sebastian Andrzej Siewior 提交于
    Just run into the following:
    - new disk arrived in the system
    - udev couldn't wait to get its hands on to to run ata_id /dev/sda
    - this sent the cdb 0xa1 to the device.
    - my UAS-gadget recevied the cdb and had no idea what to do with it. It
      decided to send a status URB back with sense set to invalid opcode.
    - the host side received it status and completed the scsi command.
    - the host sent another scsi with 4kib data buffer
    - Now I was confused why the data transfer is only 512 bytes instead of
      4kib since the host is always allocating the complete transfer in one
      go.
    - Finally the system crashed while walking through the sg list.
    
    This patch adds three new flags in order to distinguish between DATA
    URB completed and outstanding. If we receive status before data, we
    cancel data and let data complete the command.
    This solves the problem for IN and OUT transfers but does not work for
    BIDI.
    Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
    e4d8318a
uas.c 22.1 KB