Skip to content

Commit ebf8893

Browse files
committed
crypto: octeontx2 - add missing check for dma_map_single
JIRA: https://issues.redhat.com/browse/RHEL-31478 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git commit 6a6d6a3 Author: Chen Ni <nichen@iscas.ac.cn> Date: Mon Apr 8 01:59:14 2024 +0000 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: e929711 ("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> Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
1 parent 4a522af commit ebf8893

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/crypto/marvell/octeontx2/cn10k_cpt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ int cn10k_cpt_hw_ctx_init(struct pci_dev *pdev,
138138
return -ENOMEM;
139139
cptr_dma = dma_map_single(&pdev->dev, hctx, CN10K_CPT_HW_CTX_SIZE,
140140
DMA_BIDIRECTIONAL);
141+
if (dma_mapping_error(&pdev->dev, cptr_dma)) {
142+
kfree(hctx);
143+
return -ENOMEM;
144+
}
141145

142146
cn10k_cpt_hw_ctx_set(hctx, 1);
143147
er_ctx->hw_ctx = hctx;

0 commit comments

Comments
 (0)