• Akinobu Mita's avatar
    target/rd: Don't pass incomplete scatterlist entries to sbc_dif_verify_* · bfd9a53e
    Akinobu Mita authored
    The scatterlist for protection information which is passed to
    sbc_dif_verify_read() or sbc_dif_verify_write() requires that
    neighboring scatterlist entries are contiguous or chained so that they
    can be iterated by sg_next().
    
    However, the protection information for RD-MCP backends could be located
    in the multiple scatterlist arrays when the ramdisk space is too large.
    So if the read/write request straddles this boundary, sbc_dif_verify_read()
    or sbc_dif_verify_write() can't iterate all scatterlist entries.
    
    This problem can be fixed by chaining protection information scatterlist
    at creation time.  For the architectures which don't support sg chaining
    (i.e. !CONFIG_ARCH_HAS_SG_CHAIN), fix it by allocating temporary
    scatterlist if needed.
    Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
    Cc: Nicholas Bellinger <nab@linux-iscsi.org>
    Cc: Sagi Grimberg <sagig@dev.mellanox.co.il>
    Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
    Cc: target-devel@vger.kernel.org
    Cc: linux-scsi@vger.kernel.org
    Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
    bfd9a53e
target_core_rd.c 19.2 KB