aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_sbc.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2015-05-01 02:23:48 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2015-05-31 01:42:23 -0400
commit57636388af32c2c7db3919e8d53f4979b7c7c307 (patch)
tree0ce8ebfdf5e3d95b2a6a2a9145964a97f31f9440 /drivers/target/target_core_sbc.c
parent144bc4c2a42a0f42a32c106d53f5bf2724fbf098 (diff)
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: Akinobu 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: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_sbc.c')
-rw-r--r--drivers/target/target_core_sbc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index d441975604db..d615a11dc9c9 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -1300,13 +1300,14 @@ void sbc_dif_copy_prot(struct se_cmd *cmd, unsigned int sectors, bool read,
1300 copied += len; 1300 copied += len;
1301 psg_len -= len; 1301 psg_len -= len;
1302 1302
1303 kunmap_atomic(addr - sg->offset - offset);
1304
1303 if (offset >= sg->length) { 1305 if (offset >= sg->length) {
1304 sg = sg_next(sg); 1306 sg = sg_next(sg);
1305 offset = 0; 1307 offset = 0;
1306 } 1308 }
1307 kunmap_atomic(addr);
1308 } 1309 }
1309 kunmap_atomic(paddr); 1310 kunmap_atomic(paddr - psg->offset);
1310 } 1311 }
1311} 1312}
1312EXPORT_SYMBOL(sbc_dif_copy_prot); 1313EXPORT_SYMBOL(sbc_dif_copy_prot);