• FUJITA Tomonori's avatar
    [SCSI] stex: stex_direct_copy shouldn't call dma_map_sg · 26106e3c
    FUJITA Tomonori authored
    stex_direct_copy copies an in-kernel buffer to a sg list in order to
    spoof some SCSI commands. stex_direct_copy calls dma_map_sg and then
    stex_internal_copy with the value that dma_map_sg returned. It calls
    scsi_kmap_atomic_sg to copy data.
    
    scsi_kmap_atomic_sg doesn't see sg->dma_length so if dma_map_sg merges
    sg entries, stex_internal_copy gets the smaller number of sg entries
    than the acutual number, which means it wrongly think that the data
    length in the sg list is shorter than the actual length.
    
    stex_direct_copy shouldn't call dma_map_sg and it doesn't need since
    this code path doesn't involve dma transfers. This patch removes
    stex_direct_copy and simply calls stex_internal_copy with the actual
    number of sg entries.
    Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
    Acked-by: default avatarEd Lin <ed.lin@promise.com>
    Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
    26106e3c
stex.c 33.2 KB