diff options
| author | Thomas Fourier <fourier.thomas@gmail.com> | 2025-06-30 11:23:46 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-08-15 12:08:52 +0200 |
| commit | a99cae46ab16db7abac8b150c0499f59cfea7f4d (patch) | |
| tree | 2f350ea79e9a7cb3914b1917d4d08c0fc62dcd5b /drivers/infiniband | |
| parent | 8724a228be434a30d98243e4d4eba71a518eb070 (diff) | |
| download | linux-a99cae46ab16db7abac8b150c0499f59cfea7f4d.tar.gz linux-a99cae46ab16db7abac8b150c0499f59cfea7f4d.tar.bz2 linux-a99cae46ab16db7abac8b150c0499f59cfea7f4d.zip | |
Fix dma_unmap_sg() nents value
[ Upstream commit 1db50f7b7a793670adcf062df9ff27798829d963 ]
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: ed10435d3583 ("RDMA/erdma: Implement hierarchical MTT")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Link: https://patch.msgid.link/20250630092346.81017-2-fourier.thomas@gmail.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/infiniband')
| -rw-r--r-- | drivers/infiniband/hw/erdma/erdma_verbs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/erdma/erdma_verbs.c b/drivers/infiniband/hw/erdma/erdma_verbs.c index b010c4209ea3..29ad2f5ffabe 100644 --- a/drivers/infiniband/hw/erdma/erdma_verbs.c +++ b/drivers/infiniband/hw/erdma/erdma_verbs.c @@ -585,7 +585,8 @@ err_free_mtt: static void erdma_destroy_mtt_buf_sg(struct erdma_dev *dev, struct erdma_mtt *mtt) { - dma_unmap_sg(&dev->pdev->dev, mtt->sglist, mtt->nsg, DMA_TO_DEVICE); + dma_unmap_sg(&dev->pdev->dev, mtt->sglist, + DIV_ROUND_UP(mtt->size, PAGE_SIZE), DMA_TO_DEVICE); vfree(mtt->sglist); } |
