Commit 57636388 authored by Akinobu Mita's avatar Akinobu Mita Committed by Nicholas Bellinger

target: Fix inconsistent address passed to kunmap_atomic() in sbc_dif_copy_prot()

In sbc_dif_copy_prot(), the addresses passed to kunmap_atomic() are
inconsistent with the addresses which are mapped by kmap_atomic().
That could be problematic if an SG element has its length larger than
PAGE_SIZE as kunmap_atomic() will attempt to unmap different page.
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Sagi Grimberg <sagig@mellanox.com>
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>
parent 144bc4c2
...@@ -1300,13 +1300,14 @@ void sbc_dif_copy_prot(struct se_cmd *cmd, unsigned int sectors, bool read, ...@@ -1300,13 +1300,14 @@ void sbc_dif_copy_prot(struct se_cmd *cmd, unsigned int sectors, bool read,
copied += len; copied += len;
psg_len -= len; psg_len -= len;
kunmap_atomic(addr - sg->offset - offset);
if (offset >= sg->length) { if (offset >= sg->length) {
sg = sg_next(sg); sg = sg_next(sg);
offset = 0; offset = 0;
} }
kunmap_atomic(addr);
} }
kunmap_atomic(paddr); kunmap_atomic(paddr - psg->offset);
} }
} }
EXPORT_SYMBOL(sbc_dif_copy_prot); EXPORT_SYMBOL(sbc_dif_copy_prot);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment