mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] crypto: octeontx2 - add missing check for dma_map_single
@ 2024-04-08  1:59 Chen Ni
  2024-04-09  4:23 ` [EXTERNAL] " Bharat Bhushan
  2024-04-19 10:57 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Ni @ 2024-04-08  1:59 UTC (permalink / raw)
  To: bbrezillon, arno, schalla, herbert, davem
  Cc: linux-crypto, linux-kernel, Chen Ni

Add check for dma_map_single() and return error if it fails in order
to avoid invalid dma address.

Fixes: e92971117c2c ("crypto: octeontx2 - add ctx_val workaround")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/crypto/marvell/octeontx2/cn10k_cpt.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/crypto/marvell/octeontx2/cn10k_cpt.c b/drivers/crypto/marvell/octeontx2/cn10k_cpt.c
index 79b4e74804f6..6bfc59e67747 100644
--- a/drivers/crypto/marvell/octeontx2/cn10k_cpt.c
+++ b/drivers/crypto/marvell/octeontx2/cn10k_cpt.c
@@ -138,6 +138,10 @@ int cn10k_cpt_hw_ctx_init(struct pci_dev *pdev,
 		return -ENOMEM;
 	cptr_dma = dma_map_single(&pdev->dev, hctx, CN10K_CPT_HW_CTX_SIZE,
 				  DMA_BIDIRECTIONAL);
+	if (dma_mapping_error(&pdev->dev, cptr_dma)) {
+		kfree(hctx);
+		return -ENOMEM;
+	}
 
 	cn10k_cpt_hw_ctx_set(hctx, 1);
 	er_ctx->hw_ctx = hctx;
-- 
2.25.1


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

end of thread, other threads:[~2024-04-19 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08  1:59 [PATCH] crypto: octeontx2 - add missing check for dma_map_single Chen Ni
2024-04-09  4:23 ` [EXTERNAL] " Bharat Bhushan
2024-04-19 10:57 ` Herbert Xu

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®