From: Sagi Grimberg Date: Tue, 14 Apr 2015 15:08:13 +0000 (+0300) Subject: IB/iser: Fix wrong calculation of protection buffer length X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a065fe6aa25ba6ba93c02dc13486131bb3c64d5f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git IB/iser: Fix wrong calculation of protection buffer length This length miss-calculation may cause a silent data corruption in the DIX case and cause the device to reference unmapped area. Fixes: d77e65350f2d ('libiscsi, iser: Adjust data_length to include protection information') Signed-off-by: Sagi Grimberg Signed-off-by: Doug Ledford --- diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index 20e859a6f1a6..76eb57b31a59 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c @@ -409,8 +409,8 @@ int iser_send_command(struct iscsi_conn *conn, if (scsi_prot_sg_count(sc)) { prot_buf->buf = scsi_prot_sglist(sc); prot_buf->size = scsi_prot_sg_count(sc); - prot_buf->data_len = data_buf->data_len >> - ilog2(sc->device->sector_size) * 8; + prot_buf->data_len = (data_buf->data_len >> + ilog2(sc->device->sector_size)) * 8; } if (hdr->flags & ISCSI_FLAG_CMD_READ) {