Skip to contentSkip to conversation

RDMA/ionic: unmap query QP buffers with their mapped size

PATCH Applied Thomas Fourier 3 participants 3 messages Dec 1 – Dec 2

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/ionic: unmap query QP buffers with their mapped size

ionic_query_qp_cmd() maps query_sqbuf and query_rqbuf with PAGE_SIZE but unmaps them with sizeof(*query_sqbuf) and sizeof(*query_rqbuf). This may lead to leaving part of the buffer mapped.

Unmap both buffers with PAGE_SIZE.

Fixes e8521822c733 ("RDMA/ionic: Register device ops for control path")
---
 drivers/infiniband/hw/ionic/ionic_controlpath.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/ionic/ionic_controlpath.c +2 -2
index e85c382f9140..a6f8699f8d2c 100644
@@ -1801,10 +1801,10 @@ static int ionic_query_qp_cmd(struct ionic_ibdev *dev,
 		kfree(hdr_buf);
 	}
 err_hdrbuf:
-	dma_unmap_single(dev->lif_cfg.hwdev, query_rqdma, sizeof(*query_rqbuf),
+	dma_unmap_single(dev->lif_cfg.hwdev, query_rqdma, PAGE_SIZE,
 			 DMA_FROM_DEVICE);
 err_rqdma:
-	dma_unmap_single(dev->lif_cfg.hwdev, query_sqdma, sizeof(*query_sqbuf),
+	dma_unmap_single(dev->lif_cfg.hwdev, query_sqdma, PAGE_SIZE,
 			 DMA_FROM_DEVICE);
 err_sqdma:
 	kfree(query_rqbuf);
Signature · 1 line
2.53.0
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 8 lines

ionic_query_qp_cmd() maps query_sqbuf and query_rqbuf with PAGE_SIZE but unmaps them with sizeof(*query_sqbuf) and sizeof(*query_rqbuf). This may lead to leaving part of the buffer mapped.

Unmap both buffers with PAGE_SIZE.

Fixes e8521822c733 ("RDMA/ionic: Register device ops for control path")

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Thomas Fourier
Quoted 8 lines · Thomas Fourier

ionic_query_qp_cmd() maps query_sqbuf and query_rqbuf with PAGE_SIZE but unmaps them with sizeof(*query_sqbuf) and sizeof(*query_rqbuf). This may lead to leaving part of the buffer mapped.

Unmap both buffers with PAGE_SIZE.

[...]

Applied, thanks!

[1/1] RDMA/ionic: unmap query QP buffers with their mapped size

      https://git.kernel.org/rdma/rdma/c/dbdfbc3279f441

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>