public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/bnxt_re: fix dma_free_coherent() pointer
@ 2025-12-30  8:51 Thomas Fourier
  2025-12-30 11:46 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Fourier @ 2025-12-30  8:51 UTC (permalink / raw)
  Cc: Thomas Fourier, stable, Selvin Xavier, Kalesh AP, Jason Gunthorpe,
	Leon Romanovsky, Somnath Kotur, Eddie Wai, Sriharsha Basavapatna,
	linux-rdma, linux-kernel

The dma_alloc_coherent() allocates a dma-mapped buffer, pbl->pg_arr[i].
The dma_free_coherent() should pass the same buffer to
dma_free_coherent() and not page-aligned.

Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 drivers/infiniband/hw/bnxt_re/qplib_res.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
index 875d7b52c06a..866dc22a2ab8 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
@@ -64,9 +64,7 @@ static void __free_pbl(struct bnxt_qplib_res *res, struct bnxt_qplib_pbl *pbl,
 		for (i = 0; i < pbl->pg_count; i++) {
 			if (pbl->pg_arr[i])
 				dma_free_coherent(&pdev->dev, pbl->pg_size,
-						  (void *)((unsigned long)
-						   pbl->pg_arr[i] &
-						  PAGE_MASK),
+						  pbl->pg_arr[i],
 						  pbl->pg_map_arr[i]);
 			else
 				dev_warn(&pdev->dev,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] RDMA/bnxt_re: fix dma_free_coherent() pointer
  2025-12-30  8:51 [PATCH] RDMA/bnxt_re: fix dma_free_coherent() pointer Thomas Fourier
@ 2025-12-30 11:46 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2025-12-30 11:46 UTC (permalink / raw)
  To: Thomas Fourier
  Cc: stable, Selvin Xavier, Kalesh AP, Jason Gunthorpe, Somnath Kotur,
	Eddie Wai, Sriharsha Basavapatna, linux-rdma, linux-kernel


On Tue, 30 Dec 2025 09:51:21 +0100, Thomas Fourier wrote:
> The dma_alloc_coherent() allocates a dma-mapped buffer, pbl->pg_arr[i].
> The dma_free_coherent() should pass the same buffer to
> dma_free_coherent() and not page-aligned.
> 
> 

Applied, thanks!

[1/1] RDMA/bnxt_re: fix dma_free_coherent() pointer
      https://git.kernel.org/rdma/rdma/c/fcd431a9627f27

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-30 11:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-30  8:51 [PATCH] RDMA/bnxt_re: fix dma_free_coherent() pointer Thomas Fourier
2025-12-30 11:46 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox