• Christian Borntraeger's avatar
    [S390] Fix memory leak in /proc/cio_ignore · 05d419b1
    Christian Borntraeger authored
    There is a memory leak in /proc/cio_ignore. The iterator is allocated
    in cio_ignore_proc_seq_start, but never freed in
    cio_ignore_proc_seq_stop, because we cannot use the iterator
    that was passed by seqfile. The seqfile interface passes the last
    seen iterator to the stop function and not the first one. Since our
    next function will return NULL at the end, the iter passed to
    cio_ignore_proc_seq_stop is NULL. The original iter has leaked.
    The solution is to use seq_open_private.
    
    Found with kmemleak:
    unreferenced object 0x1c720580 (size 32):
      comm "head", pid 973, jiffies 4294958302
      hex dump (first 32 bytes):
        00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00  ................
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
        [<0000000000203154>] kmem_cache_alloc+0x190/0x19c
        [<00000000003fb462>] cio_ignore_proc_seq_start+0x5e/0x128
        [<0000000000231018>] seq_read+0xc8/0x4bc
        [<0000000000273954>] proc_reg_read+0xa8/0xf4
        [<000000000020e3d8>] vfs_read+0xac/0x1a4
        [<000000000020e5c6>] SyS_read+0x52/0xa8
        [<000000000011836e>] sysc_noemu+0x10/0x16
        [<0000004690b7936c>] 0x4690b7936c
    Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
    Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    05d419b1
blacklist.c 8.42 KB