12246 pci_get_irq_routing_table() leaks under UEFI

Review Request #2496 — Created Jan. 24, 2020 and submitted

citrus
illumos-gate
master
12246
c148388...
general
12246 pci_get_irq_routing_table() leaks under UEFI

Under a UEFI environment, pci_bios_get_irq_routing() returns 0 and also sets *nneededp to 0; this causes a small leak in pci_get_irq_routing_table().

kmem_alloc_512 leak: 1 buffer, 512 bytes
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
ffffff0708721018 ffffff0708706b80                0 fffffffffbc53040
                 ffffff06e1038648 ffffff06e6017a00                0
                 kmem_cache_alloc_debug+0x2fc
                 kmem_cache_alloc+0x25b
                 kmem_zalloc+0x47
                 pci_get_irq_routing_table+0x27
                 startup_pci_bios+9
                 startup+0x4a
                 main+0x96
                 _locore_start+0x90

Testing:

UEFI

bloody% tr '\0' '\n' < /system/boot/environment | grep efi
efi-version=2.70
bloody% pfexec mdb -ke pci_irq_nroutes/X
pci_irq_nroutes:
pci_irq_nroutes:0
bloody% pfexec reboot -d
...

bloody# mdb -ke ::findleaks {unix,vmcore}.7
findleaks: no memory leaks detected

BIOS

bloody% tr '\0' '\n' < /system/boot/environment | grep efi
bloody% pfexec mdb -ke pci_irq_nroutes/X
pci_irq_nroutes:
pci_irq_nroutes:20
bloody% pfexec reboot -d
...
bloody# mdb -ke ::findleaks {unix,vmcore}.8
findleaks: no memory leaks detected
mscheler
  1. LGTM

  2. usr/src/uts/i86pc/os/pci_bios.c (Diff revision 1)
     
     
    As you are changing this line anyhow: both variables should be of type "size_t" not "int".
    1. I'm only changing it because of the whitespace check - I don't want to change the types as part of this.

  3. 
      
tsoome
  1. Ship It!
  2. 
      
citrus
Review request changed

Status: Closed (submitted)

Loading...