Commit fc272ec7 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Nicholas Bellinger

Target/sbc: Don't use sg as iterator in sbc_verify_read

Because then this sg is passed to sbc_copy_prot which will
hit a protection fault in cases we have more than a single sg.
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 94387aa7
...@@ -1162,7 +1162,7 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors, ...@@ -1162,7 +1162,7 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors,
{ {
struct se_device *dev = cmd->se_dev; struct se_device *dev = cmd->se_dev;
struct se_dif_v1_tuple *sdt; struct se_dif_v1_tuple *sdt;
struct scatterlist *dsg; struct scatterlist *dsg, *psg = sg;
sector_t sector = start; sector_t sector = start;
void *daddr, *paddr; void *daddr, *paddr;
int i, j, offset = sg_off; int i, j, offset = sg_off;
...@@ -1170,14 +1170,14 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors, ...@@ -1170,14 +1170,14 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors,
for_each_sg(cmd->t_data_sg, dsg, cmd->t_data_nents, i) { for_each_sg(cmd->t_data_sg, dsg, cmd->t_data_nents, i) {
daddr = kmap_atomic(sg_page(dsg)) + dsg->offset; daddr = kmap_atomic(sg_page(dsg)) + dsg->offset;
paddr = kmap_atomic(sg_page(sg)) + sg->offset; paddr = kmap_atomic(sg_page(psg)) + sg->offset;
for (j = 0; j < dsg->length; j += dev->dev_attrib.block_size) { for (j = 0; j < dsg->length; j += dev->dev_attrib.block_size) {
if (offset >= sg->length) { if (offset >= psg->length) {
kunmap_atomic(paddr); kunmap_atomic(paddr);
sg = sg_next(sg); psg = sg_next(psg);
paddr = kmap_atomic(sg_page(sg)) + sg->offset; paddr = kmap_atomic(sg_page(psg)) + psg->offset;
offset = 0; offset = 0;
} }
......
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