ibmvscsis: Fix dma_unmap_sg() nents value
Subsystems (3)
PATCH 1/1 ibmvscsis: 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 88a678bbc34c ("ibmvscsis: Initial commit of IBM VSCSI Tgt Driver")
Signed-off-by Thomas Fourier <[email protected]>
--- drivers/scsi/ibmvscsi_tgt/libsrp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/ibmvscsi_tgt/libsrp.c +4 -2
@@ -184,7 +184,8 @@ static int srp_direct_data(struct ibmvscsis_cmd *cmd, struct srp_direct_buf *md, err =rdma_io (cmd, sg, nsg, md,1 , dir, len);if (dma_map) -dma_unmap_sg (iue->target->dev, sg, nsg,DMA_BIDIRECTIONAL ); +dma_unmap_sg (iue->target->dev, sg, cmd->se_cmd.t_data_nents, +DMA_BIDIRECTIONAL );return err; }
@@ -256,7 +257,8 @@ static int srp_indirect_data(struct ibmvscsis_cmd *cmd, struct srp_cmd *srp_cmd, err =rdma_io (cmd, sg, nsg, md, nmd, dir, len);if (dma_map) -dma_unmap_sg (iue->target->dev, sg, nsg,DMA_BIDIRECTIONAL ); +dma_unmap_sg (iue->target->dev, sg, cmd->se_cmd.t_data_nents, +DMA_BIDIRECTIONAL ); free_mem:if (token && dma_map) {
Signature · 1 line
2.43.0
Martin K. Petersen
AppliedThomas,
Quoted 2 lines
The
dma_unmap_sg()functions should be called with the same nents as thedma_map_sg(), not the value the map function returned.
Applied to 6.17/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Martin K. Petersen
AppliedQuoted 4 lines · Thomas Fourier
The
dma_unmap_sg()functions should be called with the same nents as thedma_map_sg(), not the value the map function returned.
Applied to 6.17/scsi-queue, thanks!
[1/1] ibmvscsis: Fix dma_unmap_sg() nents value
https://git.kernel.org/mkp/scsi/c/023a293b9cd0
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering