]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: ccp - Fix a resource leak in an error handling path
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 16 May 2021 06:58:04 +0000 (08:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:15:47 +0000 (16:15 +0200)
[ Upstream commit a6f8e68e238a15bb15f1726b35c695136c64eaba ]

If an error occurs after calling 'sp_get_irqs()', 'sp_free_irqs()' must be
called as already done in the error handling path.

Fixes: f4d18d656f88 ("crypto: ccp - Abstract interrupt registeration")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: John Allen <john.allen@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/ccp/sp-pci.c

index 7da93e9bebed82f5e0efbe6affcd12151f506eb4..9b2742212ea88b099721afd5f74deed4ff018edd 100644 (file)
@@ -216,7 +216,7 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                if (ret) {
                        dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n",
                                ret);
-                       goto e_err;
+                       goto free_irqs;
                }
        }
 
@@ -224,12 +224,14 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        ret = sp_init(sp);
        if (ret)
-               goto e_err;
+               goto free_irqs;
 
        dev_notice(dev, "enabled\n");
 
        return 0;
 
+free_irqs:
+       sp_free_irqs(sp);
 e_err:
        dev_notice(dev, "initialization failed\n");
        return ret;