Skip to content

Commit

Permalink
intel_th: Fix a resource leak in an error handling path
Browse files Browse the repository at this point in the history
If an error occurs after calling 'pci_alloc_irq_vectors()',
'pci_free_irq_vectors()' must be called as already done in the remove
function.

Fixes: 7b7036d ("intel_th: pci: Use MSI interrupt signalling")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Link: https://lore.kernel.org/r/20220705082637.59979-2-alexander.shishkin@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Christophe JAILLET authored and Greg Kroah-Hartman committed Jul 8, 2022
1 parent e5535ff commit 086c28a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/hwtracing/intel_th/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,21 @@ static int intel_th_pci_probe(struct pci_dev *pdev,
}

th = intel_th_alloc(&pdev->dev, drvdata, resource, r);
if (IS_ERR(th))
return PTR_ERR(th);
if (IS_ERR(th)) {
err = PTR_ERR(th);
goto err_free_irq;
}

th->activate = intel_th_pci_activate;
th->deactivate = intel_th_pci_deactivate;

pci_set_master(pdev);

return 0;

err_free_irq:
pci_free_irq_vectors(pdev);
return err;
}

static void intel_th_pci_remove(struct pci_dev *pdev)
Expand Down

0 comments on commit 086c28a

Please sign in to comment.