Skip to content

Commit

Permalink
crypto: cavium - Fix an error handling path in cpt_ucode_load_fw()
Browse files Browse the repository at this point in the history
If do_cpt_init() fails, a previous dma_alloc_coherent() call needs to be
undone.

Add the needed dma_free_coherent() before returning.

Fixes: 9e2c7d9 ("crypto: cavium - Add Support for Octeon-tx CPT Engine")
Signed-off-by: Christophe JAILLET <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
tititiou36 authored and herbertx committed Nov 15, 2024
1 parent dccd558 commit 572b7cf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/crypto/cavium/cpt/cptpf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae)

ret = do_cpt_init(cpt, mcode);
if (ret) {
dma_free_coherent(&cpt->pdev->dev, mcode->code_size,
mcode->code, mcode->phys_base);
dev_err(dev, "do_cpt_init failed with ret: %d\n", ret);
goto fw_release;
}
Expand Down

0 comments on commit 572b7cf

Please sign in to comment.