• Konrad Rzeszutek Wilk's avatar
    xen/smp: Don't leak interrupt name when offlining. · b85fffec
    Konrad Rzeszutek Wilk authored
    When the user does:
    echo 0 > /sys/devices/system/cpu/cpu1/online
    echo 1 > /sys/devices/system/cpu/cpu1/online
    
    kmemleak reports:
    kmemleak: 7 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
    
    unreferenced object 0xffff88003fa51240 (size 32):
      comm "swapper/0", pid 1, jiffies 4294667339 (age 1027.789s)
      hex dump (first 32 bytes):
        72 65 73 63 68 65 64 31 00 00 00 00 00 00 00 00  resched1........
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<ffffffff81660721>] kmemleak_alloc+0x21/0x50
        [<ffffffff81190aac>] __kmalloc_track_caller+0xec/0x2a0
        [<ffffffff812fe1bb>] kvasprintf+0x5b/0x90
        [<ffffffff812fe228>] kasprintf+0x38/0x40
        [<ffffffff81047ed1>] xen_smp_intr_init+0x41/0x2c0
        [<ffffffff816636d3>] xen_cpu_up+0x393/0x3e8
        [<ffffffff8166bbf5>] _cpu_up+0xd1/0x14b
        [<ffffffff8166bd48>] cpu_up+0xd9/0xec
        [<ffffffff81ae6e4a>] smp_init+0x4b/0xa3
        [<ffffffff81ac4981>] kernel_init_freeable+0xdb/0x1e6
        [<ffffffff8165ce39>] kernel_init+0x9/0xf0
        [<ffffffff8167edfc>] ret_from_fork+0x7c/0xb0
        [<ffffffffffffffff>] 0xffffffffffffffff
    
    This patch fixes some of it by using the 'struct xen_common_irq->name'
    field to stash away the char so that it can be freed when
    the interrupt line is destroyed.
    Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    b85fffec
smp.c 16.6 KB