Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: cavium - Fix an error handling path in cpt_ucode_load_fw()

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>

authored by

Christophe JAILLET and committed by
Herbert Xu
572b7cf0 dccd5589

+2
+2
drivers/crypto/cavium/cpt/cptpf_main.c
··· 302 302 303 303 ret = do_cpt_init(cpt, mcode); 304 304 if (ret) { 305 + dma_free_coherent(&cpt->pdev->dev, mcode->code_size, 306 + mcode->code, mcode->phys_base); 305 307 dev_err(dev, "do_cpt_init failed with ret: %d\n", ret); 306 308 goto fw_release; 307 309 }