Subject: memory leak in sock_hash_update_common

From: syzbot <[email-masked]>
Date: Wed, 22 May 2019 08:58:06 -0700

Hello,

syzbot found the following crash on:

HEAD commit:    9c7db500 Merge tag 'selinux-pr-20190521' of git://git.kern..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1287358aa00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=61dd9e15a761691d
dashboard link: https://syzkaller.appspot.com/bug?extid=30c7a1fc662026545124
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1284fb9ca00000

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

dy
BUG: memory leak
unreferenced object 0xffff88810dc30340 (size 64):
   comm "softirq", pid 0, jiffies 4294949769 (age 8.870s)
   hex dump (first 32 bytes):
     00 70 f4 14 81 88 ff ff 00 2a c3 1b 82 88 ff ff  .p.......*......
     bf 84 c1 58 00 00 00 00 c0 f2 cc 0d 81 88 ff ff  ...X............
   backtrace:
     [<0000000059c77455>] kmemleak_alloc_recursive  
include/linux/kmemleak.h:55 [inline]
     [<0000000059c77455>] slab_post_alloc_hook mm/slab.h:439 [inline]
     [<0000000059c77455>] slab_alloc_node mm/slab.c:3269 [inline]
     [<0000000059c77455>] kmem_cache_alloc_node_trace+0x15b/0x2a0  
mm/slab.c:3597
     [<00000000a3eee734>] __do_kmalloc_node mm/slab.c:3619 [inline]
     [<00000000a3eee734>] __kmalloc_node+0x38/0x50 mm/slab.c:3627
     [<00000000869e2762>] kmalloc_node include/linux/slab.h:590 [inline]
     [<00000000869e2762>] sock_hash_alloc_elem net/core/sock_map.c:639  
[inline]
     [<00000000869e2762>] sock_hash_update_common+0x301/0x540  
net/core/sock_map.c:690
     [<00000000ae16fa93>] sock_hash_update_elem+0xf0/0x130  
net/core/sock_map.c:739
     [<0000000047230865>] map_update_elem kernel/bpf/syscall.c:925 [inline]
     [<0000000047230865>] __do_sys_bpf+0x19b7/0x1dd0  
kernel/bpf/syscall.c:2801
     [<00000000fb5f3bec>] __se_sys_bpf kernel/bpf/syscall.c:2772 [inline]
     [<00000000fb5f3bec>] __x64_sys_bpf+0x1e/0x30 kernel/bpf/syscall.c:2772
     [<000000007b931104>] do_syscall_64+0x76/0x1a0  
arch/x86/entry/common.c:301
     [<00000000e7e5ff7d>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches