Skip to content

Commit 023a293

Browse files
Thomas-fouriermartinkpetersen
authored andcommitted
scsi: ibmvscsi_tgt: Fix dma_unmap_sg() nents value
The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned. Fixes: 88a678b ("ibmvscsis: Initial commit of IBM VSCSI Tgt Driver") Signed-off-by: Thomas Fourier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 278577d commit 023a293

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/scsi/ibmvscsi_tgt/libsrp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ static int srp_direct_data(struct ibmvscsis_cmd *cmd, struct srp_direct_buf *md,
184184
err = rdma_io(cmd, sg, nsg, md, 1, dir, len);
185185

186186
if (dma_map)
187-
dma_unmap_sg(iue->target->dev, sg, nsg, DMA_BIDIRECTIONAL);
187+
dma_unmap_sg(iue->target->dev, sg, cmd->se_cmd.t_data_nents,
188+
DMA_BIDIRECTIONAL);
188189

189190
return err;
190191
}
@@ -256,7 +257,8 @@ static int srp_indirect_data(struct ibmvscsis_cmd *cmd, struct srp_cmd *srp_cmd,
256257
err = rdma_io(cmd, sg, nsg, md, nmd, dir, len);
257258

258259
if (dma_map)
259-
dma_unmap_sg(iue->target->dev, sg, nsg, DMA_BIDIRECTIONAL);
260+
dma_unmap_sg(iue->target->dev, sg, cmd->se_cmd.t_data_nents,
261+
DMA_BIDIRECTIONAL);
260262

261263
free_mem:
262264
if (token && dma_map) {

0 commit comments

Comments
 (0)