summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/marvell
diff options
context:
space:
mode:
authorChen Ni <nichen@iscas.ac.cn>2024-04-08 03:59:14 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2024-04-19 12:54:18 +0200
commit6a6d6a3a328a59ed0d8ae2e65696ef38e49133a0 (patch)
tree802ed32ebba56fa7a1db9b5396766d8c4b2b96fe /drivers/crypto/marvell
parentcrypto: x86/aes-xts - make non-AVX implementation use new glue code (diff)
downloadlinux-6a6d6a3a328a59ed0d8ae2e65696ef38e49133a0.tar.xz
linux-6a6d6a3a328a59ed0d8ae2e65696ef38e49133a0.zip
crypto: octeontx2 - add missing check for dma_map_single
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> Reviewed-by: Bharat Bhushan <bbhushan2@marvell.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/marvell')
-rw-r--r--drivers/crypto/marvell/octeontx2/cn10k_cpt.c4
1 files changed, 4 insertions, 0 deletions
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;