2024-04-09 04:28:28

by Bharat Bhushan

[permalink] [raw]
Subject: RE: [EXTERNAL] [PATCH] crypto: octeontx2 - add missing check for dma_map_single



> -----Original Message-----
> From: Chen Ni <[email protected]>
> Sent: Monday, April 8, 2024 7:29 AM
> To: [email protected]; [email protected]; Srujana Challa
> <[email protected]>; [email protected];
> [email protected]
> Cc: [email protected]; [email protected]; Chen Ni
> <[email protected]>
> Subject: [EXTERNAL] [PATCH] 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 <[email protected]>
> ---
> 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;
> + }

Thanks for fixing,
Reviewed-by: Bharat Bhushan <[email protected]>

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