• Damien George's avatar
    stm32/usbdev: Fix calculation of SCSI LUN size with multiple LUNs. · fd2ff867
    Damien George authored
    The SCSI driver calls GetCapacity to get the block size and number of
    blocks of the underlying block-device/LUN.  It caches these values and uses
    them later on to verify that reads/writes are within the bounds of the LUN.
    But, prior to this commit, there was only one set of cached values for all
    LUNs, so the bounds checking for a LUN could use incorrect values, values
    from one of the other LUNs that most recently updated the cached values.
    This would lead to failed SCSI requests.
    
    This commit fixes this issue by having separate cached values for each LUN.
    Signed-off-by: default avatarDamien George <damien@micropython.org>
    fd2ff867
usbd_msc_scsi.c 20.8 KB