Subject: [syzbot] memory leak in bpf (2)

From: syzbot <[email-masked]>
Date: Wed, 31 Mar 2021 18:08:16 -0700

Hello,

syzbot found the following issue on:

HEAD commit:    0f4498ce Merge tag 'for-5.12/dm-fixes-2' of git://git.kern..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1250e126d00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=49f2683f4e7a4347
dashboard link: https://syzkaller.appspot.com/bug?extid=5d895828587f49e7fe9b
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10a17016d00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10a32016d00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email-masked]

Warning: Permanently added '10.128.0.74' (ECDSA) to the list of known hosts.
executing program
executing program
BUG: memory leak
unreferenced object 0xffff8881133295c0 (size 64):
  comm "syz-executor529", pid 8395, jiffies 4294943939 (age 8.130s)
  hex dump (first 32 bytes):
    40 48 3c 04 00 ea ff ff 00 48 3c 04 00 ea ff ff  @H<......H<.....
    c0 e7 3c 04 00 ea ff ff 80 e7 3c 04 00 ea ff ff  ..<.......<.....
  backtrace:
    [<ffffffff8139511c>] kmalloc_node include/linux/slab.h:577 [inline]
    [<ffffffff8139511c>] __bpf_map_area_alloc+0xfc/0x120 kernel/bpf/syscall.c:300
    [<ffffffff813d2414>] bpf_ringbuf_area_alloc kernel/bpf/ringbuf.c:90 [inline]
    [<ffffffff813d2414>] bpf_ringbuf_alloc kernel/bpf/ringbuf.c:131 [inline]
    [<ffffffff813d2414>] ringbuf_map_alloc kernel/bpf/ringbuf.c:170 [inline]
    [<ffffffff813d2414>] ringbuf_map_alloc+0x134/0x350 kernel/bpf/ringbuf.c:146
    [<ffffffff8139c8d3>] find_and_alloc_map kernel/bpf/syscall.c:122 [inline]
    [<ffffffff8139c8d3>] map_create kernel/bpf/syscall.c:828 [inline]
    [<ffffffff8139c8d3>] __do_sys_bpf+0x7c3/0x2fe0 kernel/bpf/syscall.c:4375
    [<ffffffff842df20d>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
    [<ffffffff84400068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at [email-masked].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches