* [PATCH] ibmvscsis: Fix dma_unmap_sg() nents value
@ 2025-06-30 11:18 Thomas Fourier
2025-07-14 17:02 ` Martin K. Petersen
2025-07-22 3:46 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Fourier @ 2025-06-30 11:18 UTC (permalink / raw)
Cc: Thomas Fourier, Tyrel Datwyler, James E.J. Bottomley,
Martin K. Petersen, Nicholas Bellinger, Steven Royer,
Bryant G. Ly, Michael Cyr, linux-scsi, target-devel,
linux-kernel
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 <fourier.thomas@gmail.com>
---
drivers/scsi/ibmvscsi_tgt/libsrp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/ibmvscsi_tgt/libsrp.c b/drivers/scsi/ibmvscsi_tgt/libsrp.c
index 8a0e28aec928..0ecad398ed3d 100644
--- a/drivers/scsi/ibmvscsi_tgt/libsrp.c
+++ b/drivers/scsi/ibmvscsi_tgt/libsrp.c
@@ -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) {
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ibmvscsis: Fix dma_unmap_sg() nents value
2025-06-30 11:18 [PATCH] ibmvscsis: Fix dma_unmap_sg() nents value Thomas Fourier
@ 2025-07-14 17:02 ` Martin K. Petersen
2025-07-22 3:46 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2025-07-14 17:02 UTC (permalink / raw)
To: Thomas Fourier
Cc: Tyrel Datwyler, James E.J. Bottomley, Martin K. Petersen,
Nicholas Bellinger, Steven Royer, Bryant G. Ly, Michael Cyr,
linux-scsi, target-devel, linux-kernel
Thomas,
> The dma_unmap_sg() functions should be called with the same nents as
> the dma_map_sg(), not the value the map function returned.
Applied to 6.17/scsi-staging, thanks!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ibmvscsis: Fix dma_unmap_sg() nents value
2025-06-30 11:18 [PATCH] ibmvscsis: Fix dma_unmap_sg() nents value Thomas Fourier
2025-07-14 17:02 ` Martin K. Petersen
@ 2025-07-22 3:46 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2025-07-22 3:46 UTC (permalink / raw)
To: Thomas Fourier
Cc: Martin K . Petersen, Tyrel Datwyler, James E.J. Bottomley,
Nicholas Bellinger, Steven Royer, Bryant G. Ly, Michael Cyr,
linux-scsi, target-devel, linux-kernel
On Mon, 30 Jun 2025 13:18:02 +0200, Thomas Fourier wrote:
> The dma_unmap_sg() functions should be called with the same nents as the
> dma_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
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-22 3:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-30 11:18 [PATCH] ibmvscsis: Fix dma_unmap_sg() nents value Thomas Fourier
2025-07-14 17:02 ` Martin K. Petersen
2025-07-22 3:46 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®