diff options
| author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2024-11-08 18:22:27 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-12-09 10:31:50 +0100 |
| commit | a40520a7a5e6b743a74649fa9725c3c2c9fe48ab (patch) | |
| tree | cf45587b6988edf46f700cce3adb15772090eb37 /drivers/crypto | |
| parent | ae5253313e0ea5f00c06176074592b7f493c8546 (diff) | |
| download | linux-a40520a7a5e6b743a74649fa9725c3c2c9fe48ab.tar.gz linux-a40520a7a5e6b743a74649fa9725c3c2c9fe48ab.tar.bz2 linux-a40520a7a5e6b743a74649fa9725c3c2c9fe48ab.zip | |
crypto: cavium - Fix an error handling path in cpt_ucode_load_fw()
[ Upstream commit 572b7cf08403b6c67dfe0dc3e0f2efb42443254f ]
If do_cpt_init() fails, a previous dma_alloc_coherent() call needs to be
undone.
Add the needed dma_free_coherent() before returning.
Fixes: 9e2c7d99941d ("crypto: cavium - Add Support for Octeon-tx CPT Engine")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/crypto')
| -rw-r--r-- | drivers/crypto/cavium/cpt/cptpf_main.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/crypto/cavium/cpt/cptpf_main.c b/drivers/crypto/cavium/cpt/cptpf_main.c index ec17beee24c0..54de869e5374 100644 --- a/drivers/crypto/cavium/cpt/cptpf_main.c +++ b/drivers/crypto/cavium/cpt/cptpf_main.c @@ -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; } |
