• Konrad Rzeszutek Wilk's avatar
    xen/spinlock: Don't leak interrupt name when offlining. · 354e7b76
    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 0xffff88003fa51260 (size 32):
      comm "swapper/0", pid 1, jiffies 4294667339 (age 1027.789s)
      hex dump (first 32 bytes):
        73 70 69 6e 6c 6f 63 6b 31 00 00 00 00 00 00 00  spinlock1.......
        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
        [<ffffffff81663789>] xen_init_lock_cpu+0x61/0xbe
        [<ffffffff816633a6>] xen_cpu_up+0x66/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
    
    Instead of doing it like the "xen/smp: Don't leak interrupt name when offlining"
    patch did (which has a per-cpu structure which contains both the
    IRQ number and char*) we use a per-cpu pointers to a *char.
    
    The reason is that the "__this_cpu_read(lock_kicker_irq);" macro
    blows up with "__bad_size_call_parameter()" as the size of the
    returned structure is not within the parameters of what it expects
    and optimizes for.
    Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    354e7b76
spinlock.c 11.7 KB