Skip to content

Commit

Permalink
ACPI / PCI: fix acpi_pci_irq_enable() memory leak
Browse files Browse the repository at this point in the history
In acpi_pci_irq_enable(), 'entry' is allocated by kzalloc() in
acpi_pci_irq_check_entry() (invoked from acpi_pci_irq_lookup()). However,
it is not deallocated if acpi_pci_irq_valid() returns false, leading to a
memory leak. To fix this issue, free 'entry' before returning 0.

Fixes: e237a55 ("x86/ACPI/PCI: Recognize that Interrupt Line 255 means "not connected"")
Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Wenwen Wang authored and Rafael J. Wysocki committed Sep 3, 2019
1 parent 8698fab commit 29b4995
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/acpi/pci_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,10 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
* No IRQ known to the ACPI subsystem - maybe the BIOS /
* driver reported one, then use it. Exit in any case.
*/
if (!acpi_pci_irq_valid(dev, pin))
if (!acpi_pci_irq_valid(dev, pin)) {
kfree(entry);
return 0;
}

if (acpi_isa_register_gsi(dev))
dev_warn(&dev->dev, "PCI INT %c: no GSI\n",
Expand Down

0 comments on commit 29b4995

Please sign in to comment.