[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a6ppwcmc.ffs@nanos.tec.linutronix.de>
Date: Fri, 23 Apr 2021 11:53:31 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Bjorn Helgaas <helgaas@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, Wenwen Wang <wang6495@....edu>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 086/190] Revert "x86/PCI: Fix PCI IRQ routing table memory leak"
On Thu, Apr 22 2021 at 00:09, Bjorn Helgaas wrote:
> On Wed, Apr 21, 2021 at 02:59:21PM +0200, Greg Kroah-Hartman wrote:
> I would prefer that you not apply this revert.
>
> Prior to ea094d53580f ("x86/PCI: Fix PCI IRQ routing table memory
> leak"), we had essentially this:
>
> pcibios_irq_init()
> pirq_table = pcibios_get_irq_routing_table(); # kmallocs
> if (pirq_table) {
> if (io_apic_assign_pci_irqs)
> pirq_table = NULL;
> }
>
> So if we called pcibios_get_irq_routing_table(), we kmalloced some
> space and then (if io_apic_assign_pci_irqs) threw away the pointer,
> which leaks the pointer as the commit log says.
>
> After ea094d53580f, we have:
>
> pcibios_irq_init()
> rtable = NULL;
> pirq_table = pcibios_get_irq_routing_table(); # kmallocs
> rtable = pirq_table;
> if (pirq_table) {
> if (io_apic_assign_pci_irqs) {
> kfree(rtable);
> pirq_table = NULL;
> }
> }
>
> which seems right to me.
It is correct.
Though looking at it again, the question is why this invokes
pcibios_get_irq_routing_table() at all if io_apic_assign_pci_irqs is
true?
Thanks,
tglx
Powered by blists - more mailing lists