]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
octeontx2-af: Fix a resource leak in an error handling path in 'cgx_probe()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 29 Dec 2018 16:42:22 +0000 (17:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Jan 2019 08:20:38 +0000 (09:20 +0100)
[ Upstream commit 1492623e837fe7ca6296f7f5411328307e242771 ]

If an error occurs after the call to 'pci_alloc_irq_vectors()', we must
call 'pci_free_irq_vectors()' in order to avoid a resource leak.

The same sequence is already in place in the corresponding 'cgx_remove()'
function.

Fixes: 1463f382f58d ("octeontx2-af: Add support for CGX link management")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/marvell/octeontx2/af/cgx.c

index 12db256c8c9f97633346ab1da23a9bc02b4a934a..ee67d1c4281dd263912b9a3979113d6c2aeae7d2 100644 (file)
@@ -668,7 +668,7 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        if (!cgx->reg_base) {
                dev_err(dev, "CGX: Cannot map CSR memory space, aborting\n");
                err = -ENOMEM;
-               goto err_release_regions;
+               goto err_free_irq_vectors;
        }
 
        nvec = CGX_NVEC;
@@ -693,6 +693,8 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 err_release_lmac:
        cgx_lmac_exit(cgx);
        list_del(&cgx->cgx_list);
+err_free_irq_vectors:
+       pci_free_irq_vectors(pdev);
 err_release_regions:
        pci_release_regions(pdev);
 err_disable_device: